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.

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?

share|improve this question
    
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}]]}; –  Jens Jun 22 '12 at 4:35
    
Interesting. If I try InterpolationOrder -> 0, both plots are marked, while with InterpolationOrder -> 1, only one set is marked. Hmm... –  J. M. Jun 22 '12 at 4:36
    
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.) –  J. M. Jun 22 '12 at 4:40
add comment

1 Answer 1

up vote 10 down vote accepted

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}]

)

share|improve this answer
    
Will you log it as a bug? –  Mike Honeychurch Jun 22 '12 at 4:43
9  
Already did, Mike. –  Yu-Sung Chang Jun 22 '12 at 4:46
add comment

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.