10

Bug fixed in 12.0


Could somebody explain, why Circle does not inherit the PlotStyle of the plot when used as PlotMarkers? Here is an example:

l1 = RandomInteger[100, {20, 2}]
cross = Graphics[{Line[{{-1, 1}, {1, -1}}], Line[{{1, 1}, {-1, -1}}]}];
circle = Graphics[Circle[{0, 0}, 1]];
ListPlot[l1, PlotStyle -> Thick, PlotMarkers -> {cross, .03}]
ListPlot[l1, PlotStyle -> Thick, PlotMarkers -> {circle, .03}]

Mathematica graphics

This seem to work as expected, but the only difference is that Graphics is given a list of primitives:

circle1 = Graphics[{Circle[{0, 0}, 1]}];
ListPlot[l1, PlotStyle -> Thick, PlotMarkers -> {circle1, .03}]

Mathematica graphics

Chris K
  • 20,207
  • 3
  • 39
  • 74
Ajasja
  • 13,634
  • 2
  • 46
  • 104
  • Just look at the FullForm[] for both ... – Dr. belisarius Feb 04 '13 at 12:42
  • @belisarius Sorry, still not getting it... – Ajasja Feb 04 '13 at 12:47
  • I'm editing the title because Graphics[Line[{{-1, 1}, {1, -1}}]] shows the same behavior when used as plotmarker – Dr. belisarius Feb 04 '13 at 12:48
  • @belisarius thanks, much better. – Ajasja Feb 04 '13 at 12:50
  • @Ajasja Note that cross = Graphics[Line[{{{-1, 1}, {1, -1}}, {{1, 1}, {-1, -1}}}]]; ListPlot[l1, PlotStyle -> Thick, PlotMarkers -> {cross, .03}] also ignores the PlotStyle. So the problem is in curly brackets, try cross = Graphics[{Line[{{{-1, 1}, {1, -1}}, {{1, 1}, {-1, -1}}}]}]; ListPlot[l1, PlotStyle -> Thick, PlotMarkers -> {cross, .03}]. – Alexey Popkov Feb 04 '13 at 14:01
  • ListPlot[l1, PlotStyle -> Thick, PlotMarkers -> {Graphics[Circle[{0, 0}, 1]], 0.03}][[1, 2, 1, 1, 3]] seems the generated Insets are all that is changed, with {} around Circle Hue[0.67, 0.6, 0.6], Thickness[Large] is prepended to the Graphics in the Inset – ssch Feb 04 '13 at 17:09
  • @ssch Yes, that's why the one with ´{}´ works as expected. Do you think I can tag this as a bug? Or is this somehow the expected behaviour? – Ajasja Feb 04 '13 at 18:05
  • @Ajasja I think it's a bug too – ssch Feb 04 '13 at 20:58
  • This seems to be fixed in v12.0. – Chris K Jan 10 '20 at 20:44

1 Answers1

5

After reading the documentation for PlotStyle and Graphics I have the following hyopthesis:

PlotStyle tries to apply a graphics directive to the object circle, but as it is written in your example, circle is syntactically incorrect for accepting the directive. The syntax for applying a graphics directive to a graphics primitive must be of the form:

Graphics[{*directive1*,*directive2*, ..., *primative*[*co-ords,etc*]}]

I.e. The {} may need to be in place to allow PlotStyle to impart the directive to the object.

E.g. if circle is defined as

circle = Graphics[{Opacity[.1], Circle[{0, 0}, 1]}];

The resulting PlotMarkers will have Thick outlines and Opacity[.1]

This is consistent with composite primitives and single primitives (e.g. your cross and circle, respectively) being treated in the same fashion by Plot. In which case it is not a bug, just strict syntax.

geordie
  • 3,693
  • 1
  • 26
  • 33