Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
    
ListPlot[{{0, 0}, {1, 1}, {2, 2}}, InterpolationOrder -> 0, Joined -> True] – ssch Sep 18 '13 at 1:36
    
Perfect! Want to put that in an answer and I'll accept it? – Sean Madsen Sep 18 '13 at 1:38
1  
Possible duplicates: 30055, 864 – Michael E2 Sep 18 '13 at 1:43
up vote 5 down vote accepted

ListPlot can do this with the option InterpolationOrder -> 0

ListPlot[
   {{0, 0}, {1, 1}, {2, 2}},
   InterpolationOrder -> 0,
   Joined -> True]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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