Tag Info

Hot answers tagged

8

ListPlot[Table[f, {f, {Sin[x], Cos[x]}}, {x, 0, 2 π, 0.1}], PlotLegends ->PointLegend[ (Style[#, 40] & /@ {"sin(x)", "cos(x)"}),Alignment->Center]] Update: As noted by rcollyer in the comments Alignment is an undocumented option for PointLegend. As an alternative, the following old Pane trick works without relying on an undocumented option: ...


6

A reasonable workaround is to use SwatchLegend with LegendMarkers set: ListPlot[ Table[f, {f, {Sin[x], Cos[x]}}, {x, 0, 2 π, 0.1}], PlotLegends -> SwatchLegend[{"sin(x)", "cos(x)"}, LabelStyle -> 40, LegendMarkers -> "Bubble" ] ]


4

I can confirm the shift occurs even without the special default styling in your plot (version 9). Your issue stems directly from the use of a special font marker \[FilledSquare] in a PointLegend instead of just using a SwatchLegend. The following does not have the shifting problem. Plot[{Sin[x], Cos[x]}, {x, 0, Pi}, PlotLegends -> ...


2

Verbeia already gave you more robust alternative methods, but in direct answer to the question I believe this is due to the use of a font glyph for \[FilledSquare] and the interaction of these two issues: Point Renderings Slightly Off in Mathematica Poor anti-aliasing in Rotated text with ClearType on In summary: Font glyphs are subject to alignment ...


2

You can also do this way: plot = MatrixPlot[RandomReal[{0, 1}, {10, 10}], ColorFunction -> ColorData["GrayTones"], ImageSize -> 200, PlotLegends -> Automatic]; plot /. Rational[x_, y_] :> ScientificForm[N[x/y]] Or combine it with Brett's answer so that it works both for large and small numbers: plot = MatrixPlot[100000000 ...


2

This is not any improvement over rm-rf. In v9 you can also use Legended: Module[{f, col = {Red, Blue}, exp, leg, pm = {\[DiamondSuit], 20}}, f[legend_] := Framed[legend, FrameStyle -> Red, RoundingRadius -> 10, FrameMargins -> 5, Background -> LightBlue]; exp = GraphicsGrid[ Partition[ Table[ListPlot[{Sqrt[Range[0, 50, 5]], ...



Only top voted, non community-wiki answers of a minimum length are eligible