16
$\begingroup$

After reading the PlotMarkers documentation it seems to be all or nothing. For example if you wanted markers on some of you lines the code below seems possible/probable given the documentation:

ListPlot[Table[n^(1/p), {p, 4}, {n, 10}],
 Joined -> True,
 PlotMarkers -> {{"\[FilledSquare]", 10.9`}, None, 
   None, {"\[EmptyCircle]", 9}}]

But this doesn't work.

enter image description here

It seems that an empty string is the only way to get no markers for some of the lines if you choose markers on others. Is this correct or am I misusing PlotMarkers?

When using an empty circle marker the background is transparent so the line can be seen underneath. If I want filled white circle with an EdgeForm colour that obscures the plot line I can make one and use it as a marker as per instructions in the documentation but then I run into the headache of wanting to parse the default (or other) colours to the EdgeForm directive. This can be developed but what a headache. Has anyone got any easy work arounds?

ListPlot[Table[n^(1/p), {p, 4}, {n, 10}],
 Joined -> True,
 PlotMarkers -> {{Graphics[{EdgeForm[Directive[ColoursGoHere,Thick, Thick]], White, 
      Disk[{0, 0}, 1]}], 0.05}}]

enter image description here

$\endgroup$
  • $\begingroup$ Sticking with \[EmptyCircle], maybe Style[\[EmptyCircle] , Background -> White] ? $\endgroup$ – user1066 May 10 '12 at 10:05
  • $\begingroup$ @TomD the background is not confined to the inside of the circle. For a small font size and no other lines nearby this is not really a problem. However it is possible that the backgrounded "square" could overlap other lines. This is best seen in this example with background red and a larger font. $\endgroup$ – Mike Honeychurch May 10 '12 at 21:57
  • $\begingroup$ You are right, of course. That is good to know. $\endgroup$ – user1066 May 11 '12 at 11:57
16
$\begingroup$

The answer to your first question is that PlotMarkers doesn't really use a graphics primitive, but uses font based markers as a proxy for it. This can lead to errors in positioning on some OSes.

I'm guessing that PlotStyle has something of the form ToString@HoldForm[...] when the input is a list, which is why None and False or anything else get converted to strings. This might well be a bug/undesired behaviour, because AxesLabel -> None and AxesLabel -> {"x", None} don't behave the same way. It does seem to work for Null though, although I wouldn't have guessed it at first.

For the second question, you can adapt Yu-Sung's answer and use CurrentValue["Color"] to colour your markers. Here's your example modified to do this:

ListPlot[Table[n^(1/p), {p, 4}, {n, 10}], Joined -> True, PlotMarkers :> 
    {{Graphics[{Dynamic@EdgeForm[{CurrentValue["Color"], Thick}], 
        FaceForm[White], Disk[{0, 0}, 1]}], 0.05}}
]

enter image description here

$\endgroup$
13
$\begingroup$

The None option is the default, and is only for use when applied to all datasets as one:

ListPlot[Table[n^(1/p), {p, 4}, {n, 10}],
 Joined -> True, PlotMarkers -> None]

You can use "", Null or Spacer[0] for the result you require.

$\endgroup$
  • 6
    $\begingroup$ Just for completeness: you could also use Graphics[{}] in place of "". $\endgroup$ – Jens May 10 '12 at 7:23
  • 1
    $\begingroup$ In other words, the workaround is to use anything that formats as "empty" or invisible. $\endgroup$ – Szabolcs May 10 '12 at 8:19
  • $\begingroup$ I was using "" but wanted to clarify that None was inappropriate. thanks $\endgroup$ – Mike Honeychurch May 10 '12 at 8:46
2
$\begingroup$

Addressing only the second part of the question it may be solved using:

ListLinePlot[Table[n^(1/p), {p, 4}, {n, 10}],
  PlotMarkers -> {Graphics[{{White, Disk[]}, {Thick, Circle[]}}], 0.05}
]

enter image description here

When the first argument of Graphics is a list the style directives are prefixed.

Related:

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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