Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to create a ListLinePlot with InterpolationOrder->0. However, when using plot markers like in

ListLinePlot[{{1, 2, 3, 5, 8}, {2, 3, 6, 9, 10}, {4, 5, 7, 10, 12}}, 
 PlotMarkers -> Automatic, InterpolationOrder -> 0]

the plot markers become mixed up.

How can this be avoided?

share|improve this question
    
This has been around a while. Is it a confirmed bug or perhaps an "unexpected" feature? –  Mr.Wizard Mar 8 '13 at 22:26

2 Answers 2

up vote 8 down vote accepted

To get rid of the mixed up points you can specify Mesh->Full.

ListLinePlot[{{1, 2, 3, 5, 8}, {2, 3, 6, 9, 10}, {4, 5, 7, 10, 12}}, 
  PlotMarkers -> Automatic, Mesh -> Full, InterpolationOrder -> 0]

enter image description here

Here you can see the effect of the Mesh option when plotting interpolated data:

GraphicsGrid[
  Partition[
  ListLinePlot[{{1, 2, 3, 5, 8}, {2, 3, 6, 9, 10}, {4, 5, 7, 10, 12}},
  Mesh -> #, PlotLabel -> ToString[#], 
  InterpolationOrder -> 0] & /@ {None, 10, All, Full}, 2]]

enter image description here

share|improve this answer
    
Ok, thanks, this is working! What exactly does the option Mesh->Full ? –  Robinaut Mar 4 '13 at 18:59
    
Literally from the documentation for Mesh: Full mesh divisions between regular data points. –  VLC Mar 4 '13 at 19:13

Not an answer, but to show more clearly that there is a mix up. Plotting the lines separate and adding them in Show does not have the mix up.

d1 = {1, 2, 3, 5, 8};
d2 = {2, 3, 6, 9, 10};
d3 = {4, 5, 7, 10, 12};
plts = ListLinePlot[#, PlotMarkers -> Automatic, 
    InterpolationOrder -> 0, PlotStyle -> First[#], 
    ImageSize -> 200] &;

Grid[{
  {plts /@ {d1, d2, d3}},
  {Show[plts /@ {d1, d2, d3}, PlotRange -> All]},
  {plts@{d1, d2, d3}}
  }, Spacings -> 2]

Mathematica graphics

using version 9.0.1 on windows

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.