8
$\begingroup$

One of the fun tricks known to Mathematica users is that the default colors for Mathematica plots (as of v12) can be accessed by the ColorData[97] color scheme. So ColorData[97][1] is a light blue, ColorData[97][2] is an orange-yellow, etc. I have found this immensely useful when creating separate plots and then combining them into a single graphic.

ListPlot uses this same color scheme but also has a set of different shapes it uses for each data series, as seen below:

enter image description here

Is there a function similar to ColorData[97] that can be called to yield a filled circle given an argument of 1, a filled square given an argument of 2, a filled diamond given an argument of 3, and so forth?

$\endgroup$
2
  • 7
    $\begingroup$ Have you seen System`Private`$PlotMarkers already? $\endgroup$ Jul 21 at 17:55
  • 3
    $\begingroup$ Similarly, to get the Graphics version: Charting`CommonDump`GraphicsPlotMarkers[]. $\endgroup$
    – Domen
    Jul 21 at 18:37

1 Answer 1

4
$\begingroup$

To summarize comments by Domen and me: Graphics`PlotMarkers[] (which is aliased by System`Private`$PlotMarkers) gives glyph versions of the default markers, while Charting`CommonDump`GraphicsPlotMarkers[] gives the Graphics[] version of the default markers.

In particular, consider the following:

rr = RandomReal[1, 7];
ListPlot[Outer[Plus, Range[0, 9], rr], PlotMarkers -> Automatic] === 
ListPlot[Outer[Plus, Range[0, 9], rr],
         PlotMarkers -> Charting`CommonDump`GraphicsPlotMarkers[]]
   True
$\endgroup$
2
  • 1
    $\begingroup$ I always feel vaguely sinful accessing one of those functions involving a left apostrophe. (What are those called, anyhow?) $\endgroup$ Jul 22 at 19:53
  • 1
    $\begingroup$ We just refer to them as undocumented, for convenience. ;) $\endgroup$ Jul 22 at 20:07

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.