10

Bug introduced in 7.0.1 or earlier and fixed in 8.0.1'


Why does the following plot no use the global PlotMarkers option?

SetOptions[ListPlot, {ImageSize -> Automatic, PlotMarkers -> {"A"}}];
ListPlot[Range[10]]

Checking the global options for ListPlot shows that PlotMarkers is set on a global level:

Options[ListPlot, {PlotMarkers}] -> {PlotMarkers -> {"A"}}

If I just feed the ListPlot function all of it global options it plots correctly, but it defeats the purpose of having globally set defaults.

ListPlot[Range[10], Options[ListPlot]]

To my knowledge ListPlot[Range[10]] and ListPlot[Range[10], Options[ListPlot]] should always return the same result but in this case it does not.

I'm running Mathematica 8.0.0.0 on Mac OS X 10.6.8

Mr.Wizard
  • 271,378
  • 34
  • 587
  • 1,371
Davorak
  • 407
  • 4
  • 7
  • 3
    I don't have an authorative answer, but I have expressed my opinion on global options in this answer: http://mathematica.stackexchange.com/questions/332/how-can-i-work-out-which-functions-work-with-setoptions/385#385, which may be somewhat relevant. – Leonid Shifrin Feb 03 '12 at 20:37

2 Answers2

10

Looks like a bug that has been fixed for V8.0.1.

Brett Champion
  • 20,779
  • 2
  • 64
  • 121
7

In version 7 it appears that ListPlot only uses global Options[] that are acceptable to Graphics (probably via FilterRules). You can work around this manually with explicit declaration:

SetOptions[ListPlot, {PlotMarkers -> {"A"}, Filling -> Axis}];

ListPlot[Range[10], Options[ListPlot]]

Mathematica graphics

If you want to make this fix automatic you can do this:

Unprotect[ListPlot];

ListPlot[args___] :=
  Block[{$lpOptsFix = True},
    ListPlot[args, Options[ListPlot]]
  ] /; ! TrueQ[$lpOptsFix]
Mr.Wizard
  • 271,378
  • 34
  • 587
  • 1,371
  • Your last suggestion is pretty much going down the same road as I did when constructing the option configuratin manager which I linked to in the comment above. – Leonid Shifrin Feb 03 '12 at 21:06
  • I never meant any opposition. Just made a note to link things, because I think there is more value when related discussions or techniques presented in various places are linked together. Totally agree on complementarity. – Leonid Shifrin Feb 03 '12 at 21:38
  • Thank I was looking for something like you ListPlot rewrite. – Davorak Feb 03 '12 at 21:48
  • @Davorak, glad I could help, and thanks for the Accept. – Mr.Wizard Feb 03 '12 at 21:55