Skip to main content
Added StepFunction approach
Source Link
Carl Woll
  • 132.7k
  • 6
  • 253
  • 366

One needs to use the second documented form of ListStepPlot for this:

ListStepPlot[ Thread[{{0,2,5,9,14},Range[0,4]}], PlotRange->{{0,14},{0,5}}, PlotStyle->Red ] 

enter image description here

Update

You could also use StepFunction from my answer to (30055). Here is an example:

sf = StepFunction[Thread[{{0,2,5,9,14},Range[0,4]}], Right]; Plot[sf[t], {t, 0, 14}, PlotStyle->Directive[Thick, Red]] 

enter image description here

One needs to use the second documented form of ListStepPlot for this:

ListStepPlot[ Thread[{{0,2,5,9,14},Range[0,4]}], PlotRange->{{0,14},{0,5}}, PlotStyle->Red ] 

enter image description here

One needs to use the second documented form of ListStepPlot for this:

ListStepPlot[ Thread[{{0,2,5,9,14},Range[0,4]}], PlotRange->{{0,14},{0,5}}, PlotStyle->Red ] 

enter image description here

Update

You could also use StepFunction from my answer to (30055). Here is an example:

sf = StepFunction[Thread[{{0,2,5,9,14},Range[0,4]}], Right]; Plot[sf[t], {t, 0, 14}, PlotStyle->Directive[Thick, Red]] 

enter image description here

Source Link
Carl Woll
  • 132.7k
  • 6
  • 253
  • 366

One needs to use the second documented form of ListStepPlot for this:

ListStepPlot[ Thread[{{0,2,5,9,14},Range[0,4]}], PlotRange->{{0,14},{0,5}}, PlotStyle->Red ] 

enter image description here