4

PointSize and AbsolutePointSize seem to not be working quite right in ListPlot in version 11.1. For example, the HowTo examples controlling point size fail to alter the point size if $PlotTheme = "Monochrome". Am I wrong to expect that options specified at the individual plot level should override the plot theme? As a specific example (intentionally exaggerating the point size):

(* $PlotTheme = "Monochrome"; *)  (* uncomment to see problem *)
testData = Prime[Range[25]]
ListPlot[testData, PlotStyle -> {AbsolutePointSize[18]}]

As a separate but related question, am I right that the default point size in ListPlot under the Monochrome theme is unaesthetically large, even for plots with few points?

Alexey Popkov
  • 61,809
  • 7
  • 149
  • 368
Alan
  • 13,686
  • 19
  • 38
  • 2
    I can reproduce your problem in V11.1.1 running on OS X 10.10.2. It is just another example, out of many, of a plot theme causing an explicitly given option to be ignored. As to 2nd question concerning default point size; that is a matter of opinion. IMO the default size is fine. – m_goldberg Sep 15 '17 at 18:12
  • @m_goldberg
    1. Thanks. From the tenor of your response, it seems you consider the failure of an explicit option to override the them to be a bug.

    Correct?
    2.Rumor has it that sizing might differ on OSX; any truth to that? On a Win 10 screen, the monochrome theme points are quite large (about twice the size of the nice choice for the default theme).

    – Alan Sep 15 '17 at 22:58

2 Answers2

2

As it is correctly noted in the comments, "it is just another example, out of many, of a plot theme causing an explicitly given option to be ignored." It should be counted as a bug or at least inconvenience, so please report it to the tech support: the more reports – the higher chances that this behavior eventually will be fixed.

The reason why this happens is that "Monochrome" theme uses its own set of primitive-based PlotMarkers which by definition can't be affected by AbsolutePointSize (because they do not contain Point primitives):

ListPlot[RandomReal[{0, 1}, {5, 10, 2}], PlotTheme -> "Monochrome"]

output

Unfortunately there is no direct way to control sizes of primitive-based plot markers used by PlotThemes. As a workaround you can use the following hack (checked with Mathematica 11.2.0, but should work correctly starting from version 10.0.1):

ListPlot[RandomReal[{0, 1}, {5, 10, 2}], PlotTheme -> "Monochrome"] /. 
 Offset[c_List] :> Offset[4 c]

plot

This hack isn't well-compatible with plot legends. If you plan to use PlotLegends, the following hack is more appropriate:

markerSize = .09;
ListPlot[Table[{{i, i}}, {i, 1, 10}], PlotTheme -> "Monochrome", GridLines -> All, 
  PlotLegends -> Automatic, 
  PlotMarkers -> 
   Thread[{PlotMarkers /. Charting`ResolvePlotTheme["Monochrome", ListPlot] /. 
      Offset[c_List] :> c, markerSize}]] /. 
 Inset[g_Graphics, c_List, Automatic, s_] :> Inset[g, c, {0, 0}, s]

plot

Note that the post-processing step is necessary here: without it the triangle plot markers will be positioned incorrectly!

Or you can turn PlotMarkers off by setting PlotMarkers -> None:

ListPlot[Prime[Range[25]], PlotTheme -> "Monochrome", PlotMarkers -> None, 
 PlotStyle -> AbsolutePointSize[18]]

output

Another way is to switch to Automatic glyph-based plot markers whose size can be explicitly controlled, but I do not recommend this because such markers are positioned imprecisely by Mathematica:

ListPlot[RandomReal[{0, 1}, {5, 10, 2}], PlotTheme -> "Monochrome", 
 PlotMarkers -> {Automatic, 18}]

output

And finally for producing publication-quality plots with explicit control over plot markers I recommend my package PolygonPlotMarkers` which is compatible with plot themes:

Needs["PolygonPlotMarkers`"]

fm[name_, size_: 9] := 
  Graphics[{EdgeForm[], PolygonMarker[name, Offset[size]]}, AlignmentPoint -> {0, 0}];

SeedRandom[25] (*for reproducibility*)
ListPlot[Table[Accumulate@RandomReal[1, 10] + i, {i, 6}], PlotMarkers -> fm /@
   {"Triangle", "LeftTriangle", "Diamond", "ThreePointedStar", "UpTriangleTruncated", 
    "Square"},
 PlotTheme -> "Business"]

plot

Alexey Popkov
  • 61,809
  • 7
  • 149
  • 368
1

This addresses the issue of default point size.

$Version

"11.1.1 for Mac OS X x86 (64-bit) (April 27, 2017)"

testData = Prime[Range[25]];
ListPlot[testData, PlotTheme -> "Monochrome"]

plot1

ListPlot[testData]

plot2

The points drawn when using the Monochrome plot theme are clearly larger than ones drawn without any theme option. I prefer the size used by the Monochrome theme, so I think that saying they "unaesthetically large" is a matter of opinion.

m_goldberg
  • 107,779
  • 16
  • 103
  • 257