11
$\begingroup$

Bug introduced in 9.0 or earlier and persisting through 11.0.1 or later


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?

$\endgroup$
1
  • $\begingroup$ This has been around a while. Is it a confirmed bug or perhaps an "unexpected" feature? $\endgroup$
    – Mr.Wizard
    Mar 8, 2013 at 22:26

2 Answers 2

10
$\begingroup$

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

$\endgroup$
2
  • $\begingroup$ Ok, thanks, this is working! What exactly does the option Mesh->Full ? $\endgroup$
    – Robinaut
    Mar 4, 2013 at 18:59
  • $\begingroup$ Literally from the documentation for Mesh: Full mesh divisions between regular data points. $\endgroup$
    – VLC
    Mar 4, 2013 at 19:13
2
$\begingroup$

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

$\endgroup$

Your Answer

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

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