3
$\begingroup$

What's a simple way to plot a list of points so that they're joined with stair steps instead of straight lines between the points?

I'd imagine something like...

stairStepListPlot[{{0,0},{1,1},{2,2}}]

...would produce a flat line from {0,0} to {1,0}, then a vertical line from {1,0} to {1,1} and so on.

Can you find a concise way of producing such a plot?

$\endgroup$
2
  • $\begingroup$ ListPlot[{{0, 0}, {1, 1}, {2, 2}}, InterpolationOrder -> 0, Joined -> True] $\endgroup$
    – ssch
    Sep 18, 2013 at 1:36
  • 1
    $\begingroup$ Possible duplicates: 30055, 864 $\endgroup$
    – Michael E2
    Sep 18, 2013 at 1:43

1 Answer 1

7
$\begingroup$

ListPlot can do this with the option InterpolationOrder -> 0

ListPlot[
   {{0, 0}, {1, 1}, {2, 2}},
   InterpolationOrder -> 0,
   Joined -> True]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.