10
$\begingroup$

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

$\endgroup$
9
  • $\begingroup$ Just look at the FullForm[] for both ... $\endgroup$ Commented Feb 4, 2013 at 12:42
  • $\begingroup$ @belisarius Sorry, still not getting it... $\endgroup$
    – Ajasja
    Commented Feb 4, 2013 at 12:47
  • $\begingroup$ I'm editing the title because Graphics[Line[{{-1, 1}, {1, -1}}]] shows the same behavior when used as plotmarker $\endgroup$ Commented Feb 4, 2013 at 12:48
  • $\begingroup$ @belisarius thanks, much better. $\endgroup$
    – Ajasja
    Commented Feb 4, 2013 at 12:50
  • $\begingroup$ @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}]. $\endgroup$ Commented Feb 4, 2013 at 14:01

1 Answer 1

5
$\begingroup$

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.

$\endgroup$

Your Answer

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

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