Why does Rotate in PlotMarkers behave strangely?
One workaround is to use GeometricTransformation
instead of Rotate
. By specifying coordinates in the Offset
form we can achieve consistent size of markers on the plot and in the legend. The cropping of the markers in the legend can be avoided by increasing their sizes as MinHsuan Peng suggests:
ListLinePlot[{Prime~Array~12, Fibonacci~Array~12},
PlotMarkers ->
Graphics[{Brown,
GeometricTransformation[
Rectangle[Offset[{-5, -5}], Offset[{5, 5}]],
RotationTransform[Pi/4]]}],
PlotLegends -> LineLegend[Automatic, LegendMarkerSize -> {40, 15}]]
Comparison of the InputForm
s of the plot generated with Rotate
and with GeometricTransformation
reveals that another workaround is to specify explicitly the rotation point:
ListLinePlot[{Prime~Array~12, Fibonacci~Array~12},
PlotMarkers -> Graphics[{Brown, Rotate[Rectangle[], (Pi/4), {0, 0}]}, ImageSize -> 13],
PlotLegends -> Automatic]
This workaround proves that Rotate
in PlotMarkers
is supported but has a bug when used without explicit rotation point as the third argument. It is interesting that specifying Rectangle
coordinates in the Offset
form reveals even more strange bugs:
ListLinePlot[{Prime~Array~12, Fibonacci~Array~12},
PlotMarkers ->
Graphics[{Brown,
Rectangle[Offset[{-5, -5}], Offset[{5, 5}]]~Rotate~(Pi/4)},
ImageSize -> 10], PlotLegends -> Automatic]
But with explicit rotation point it is OK:
ListLinePlot[{Prime~Array~12, Fibonacci~Array~12},
PlotMarkers ->
Graphics[{Brown, Rotate[Rectangle[Offset[{-5, -5}], Offset[{5, 5}]], (Pi/4), {0, 0}]},
ImageSize -> 13], PlotLegends -> LineLegend[Automatic, LegendMarkerSize -> {40, 15}]]
A workaround to question 2 is to increase legend marker size:
LineLegend[Automatic, LegendMarkerSize -> {40, 20}]