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.

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

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

1 Answer 1

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.

share|improve this answer

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.