13
$\begingroup$

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


My code:

data = {MapIndexed[{First[#2], #1} &, 
    Accumulate[RandomInteger[{-1, 1}, {54}]]], 
   MapIndexed[{First[#2], #1} &, 
    Accumulate[RandomInteger[{-1, 1}, {34}]]]};

ListPlot[data,
 Axes -> False,
 AspectRatio -> 0.75,
 Frame -> True,
 InterpolationOrder -> {0, 0},
 ImageSize -> {400, 300},
 ImageMargins -> 0,
 Joined -> True,
 PlotMarkers -> {{"\[FilledCircle]", 11}, {"", 11}}
 ]

On OS X 10.6.8 V8.0.4 I get this output:

enter image description here

You will note that the filled circle plot markers have been "distributed" across both sets of data. However if I change the InterpolationOrder setting to say:

InterpolationOrder -> {0, None}

...then no markers appear for the second set of data (due to the markers being an empty string).

enter image description here

Could someone please advise me if the cause of this behaviour is due to me setting these options incorrectly? Any ideas?

$\endgroup$
  • $\begingroup$ Yes, I see this too. To see if it's related to the shape of the lists, I tried the following, but got the same wrong plot with InterpolationOrder -> {0, 0} (and it's also wrong with ListLinePlot): data = {Accumulate[RandomInteger[{-1, 1}, {54}]], Accumulate[RandomInteger[{-1, 1}, {34}]]}; $\endgroup$ – Jens Jun 22 '12 at 4:35
  • $\begingroup$ Interesting. If I try InterpolationOrder -> 0, both plots are marked, while with InterpolationOrder -> 1, only one set is marked. Hmm... $\endgroup$ – J. M. is away Jun 22 '12 at 4:36
  • $\begingroup$ Further intriguing behavior: ListPlot[data, Axes -> False, AspectRatio -> 0.75, Frame -> True, InterpolationOrder -> 0, ImageMargins -> 0, Joined -> True, PlotMarkers -> {{"\[FilledCircle]", 11}, {"\[FilledSmallSquare]", 11}}]. (Setting InterpolationOrder -> 1 gives the expected result, however.) $\endgroup$ – J. M. is away Jun 22 '12 at 4:40
  • $\begingroup$ @ilian, I presume somebody there is looking at this now? This has lasted quite a while… $\endgroup$ – J. M. is away Aug 24 '15 at 15:47
  • 1
    $\begingroup$ @J. M. I've notified the developers/QA listed on the internal bug report. $\endgroup$ – ilian Aug 24 '15 at 16:01
13
$\begingroup$

According to the doc, the second result is correct, since $i$-th specification in PlotMakers should be used for $i$-th dataset. There seems to be a bug regarding how InterpolationOrder->0 is processing PlotMarkers.

When InterpolationOrder->0, it inserts PlotMarkers at the both end of each interval. Not so for all other cases (it inserts markers on the data point). While doing so, it seems that it always picks up the first plot marker for the end interval point, instead of the correct one (n-th plot maker for n-th data set).

It is easy to confirm. Define multi-data:

SeedRandom[2]; data = {MapIndexed[{First[#2], #1} &, 
   Accumulate[RandomInteger[{0, 1}, {10}]]], 
  MapIndexed[{First[#2], #1} &, 
   Accumulate[RandomInteger[{-1, 1}, {15}]]],
  MapIndexed[{First[#2], #1} &, 
   Accumulate[RandomInteger[{-1, 0}, {15}]]]};

Then run the plot with interpolation order 0:

ListPlot[data, Axes -> False, AspectRatio -> 0.75, Frame -> True, 
 InterpolationOrder -> {0, 0, 0}, ImageSize -> {400, 300}, 
 ImageMargins -> 0, Joined -> True, 
 PlotMarkers -> {{"\[FilledCircle]", 8}, {"\[FilledSquare]", 
    10}, {"\[FilledDiamond]", 10}}]

The result is:

enter image description here

When it should have looked like this:

enter image description here

(which is generated by:

Show[MapThread[
  ListPlot[#1, Axes -> False, AspectRatio -> 0.75, Frame -> True, 
    InterpolationOrder -> 0, ImageSize -> {400, 300}, 
    ImageMargins -> 0, Joined -> True, PlotMarkers -> #2, 
    PlotStyle -> #3] &, {data, {{"\[FilledCircle]", 
     8}, {"\[FilledSquare]", 10}, {"\[FilledDiamond]", 10}}, 
   ColorData[1, "ColorList"][[1 ;; 3]]}], PlotRange -> {{0, 15}, All}]

)

$\endgroup$
  • $\begingroup$ Will you log it as a bug? $\endgroup$ – Mike Honeychurch Jun 22 '12 at 4:43
  • 10
    $\begingroup$ Already did, Mike. $\endgroup$ – Yu-Sung Chang Jun 22 '12 at 4:46
  • $\begingroup$ Three years later and the bug remains. Would someone agitate the water a bit, please? $\endgroup$ – Mr.Wizard Jun 18 '15 at 8:23
  • 3
    $\begingroup$ @Mr. Wizard, considering that Yu-Sung isn't "there" anymore, we should prolly be bugging somebody else… $\endgroup$ – J. M. is away Jun 18 '15 at 9:01
  • $\begingroup$ @J. M. Sorry, my memory is terrible. $\endgroup$ – Mr.Wizard Jun 18 '15 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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