4
$\begingroup$

How can I obtain crosses as plot markers in a ListPlot?

I know how to obtain circles, disks, squares, using Graphics, like PlotMarkers -> {Graphics[{Red, Thick, Disk[]}, ImageSize -> 10]}. But I can't think of any way to obtain a cross this way, other than actually drawing the cross, which seems overkill. Is there a simpler way? I just need some advice on the best way to do this without too much work.

$\endgroup$
3
  • 3
    $\begingroup$ Have you seen this? $\endgroup$ Commented Sep 6, 2017 at 12:51
  • 1
    $\begingroup$ ListPlot[{1, 2, 3, 4}, PlotMarkers -> "+"] ? $\endgroup$
    – Ruud3.1415
    Commented Sep 6, 2017 at 12:56
  • $\begingroup$ @Ruud3.1415 Nice! That works. To get some more fine control, you can do something like PlotMarkers -> Graphics[{Black, FontSize -> 20, Text["+"]}] $\endgroup$
    – a06e
    Commented Sep 6, 2017 at 13:01

2 Answers 2

12
$\begingroup$

Using PlotMarkers -> "+" is not a good solution, because the text is aligned with its foot at the point, not the centre of the cross.

If you want the centre of the cross to have a precise position in the plot, you can use:

cross = Graphics[{Line[{{-1,0},{1,0}}], Line[{{0,-1},{0,1}}]}] 
ListPlot[data, PlotMarkers -> {cross,0.05}]
$\endgroup$
1
  • $\begingroup$ Hi Jan, Welcome to Mma.SE. thanks for making your first contribution to Mma.SE. Be sure to take the tour. The site depends on participation, and I'm glad to see your first activity was to share what you have learned and give an answer. Your answer was flagged, as a new user, so I was checking everything was fine, and as it is, I can only welcome and thank you. (+1). $\endgroup$
    – rhermans
    Commented Aug 31, 2018 at 8:28
2
$\begingroup$

This would be a simple solution:

ListPlot[{1, 2, 3, 4}, PlotMarkers -> Style["+", {Black, FontSize -> 20}]]

enter image description here

$\endgroup$
2
  • 1
    $\begingroup$ Alternatively: ListPlot[{1, 2, 3, 4}, PlotMarkers -> Style["✚", Medium]]. $\endgroup$ Commented Sep 6, 2017 at 13:09
  • $\begingroup$ @J.M. that would be a more aesthetic solution, I edited mine $\endgroup$
    – Ruud3.1415
    Commented Sep 6, 2017 at 13:12

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.