Tag Info

New answers tagged

2

Placement in Placed is {{x_pos, y_pos}, {x_obj_pos, y_obj_pos}}, where x_pos and y_pos are scaled(from 0 to 1) position referring to the plot, and x_obj_pos and y_obj_pos are scaled position referring to the legend object. Scaled values can be outside the range of {0,1}. ArrayPlot[RandomInteger[10, {400, 400}], ColorFunction -> "ThermometerColors", ...


2

ChartLegends and PlotLegends have subtle differences, so it is not quite comparing two equivalent things. In this case, though, I think using either in this case is incorrect as you are creating your own legends, completely. I would use Legended directly, e.g. Legended[ BarChart[{{1, 2, 3, 4}, {3, 1, 2, 5}, {5, 2, 3, 2}, {2, 3, 1, 3}}], ...


5

Borrowing from kguler the legends legends = MapIndexed[ SwatchLegend[{ColorData[{"Rainbow", {1, 7}}][## & @@ #2]}, {#}, LegendMarkerSize -> {{10, 10}}] &, names]; p1 = ListLinePlot[par, ColorFunction -> "Rainbow", Ticks -> {Range[1750, 1980, 10], Automatic}, PlotRangePadding -> {{5, 50}, {0, 1}}, GridLines -> ...


29

Use the individual legends as tick labels: dates = Through[{First, Last}@#] & /@ res {{1769, 1821}, {1775, 1817}, {1770, 1831}, {1818, 1883}, {1777, 1855}, {1766, 1817}, {1870, 1924}} names={"Napoleon Bonaparte", "Jane Austen", "Hegel", "Marx", "Gauss", "Madame de Stael", "Lenin"}; llpd = MapIndexed[Thread@{#, First@#2} &, dates]; legends ...


5

I am continuing to explore this as I can't yet demonstrate exactly what is going on, but first note that ArrayPlot does not experience this problem: tab = Table[Exp[-((i - 25)^2 + (j - 25)^2)], {i, 50}, {j, 50}]; ArrayPlot[500 * tab, PlotLegends -> Automatic, ColorFunction -> "ThermometerColors"] Note that I multiplied the original table by 500 ...


1

MatrixPlot[Table[Exp[-((i - 25)^2 + (j - 25)^2)], {i, 50}, {j, 50}], PlotLegends -> Automatic, ColorFunction -> "ThermometerColors", ColorFunctionScaling -> False]


1

bl1 = Graphics[{Thickness[0.05], Line[{{0, 25}, {10, 25}}], Text[Style["200 nm", Black, FontSize -> 12], {10/2, 26}]}]; bl2 = BarLegend[{"ThermometerColors", {0, 100}}, LabelStyle -> Directive[Black, FontSize -> 12], LegendLabel -> "D33 content in wt%", LegendMarkerSize -> 300, LegendLayout -> "Row"]; lgnd = Column[{bl1, bl2}, ...


0

One way is to find the proper Placed-parameters for the black bar ArrayPlot[RandomInteger[10, {400, 400}], ColorFunction -> "ThermometerColors", PlotLegends -> { Placed[ BarLegend[{"ThermometerColors", {0, 100}}, LabelStyle -> Directive[Black, FontSize -> 12], LegendLabel -> "D33 content in wt%", LegendMarkerSize ...


1

A graphical comment to Mr. Wizard's answer: SwatchLegend[ 63, Range[3], LegendMarkers -> { Graphics[Disk[]], Graphics[Polygon[{{1, 0}, {0, 1}, {-1, 0}, {0, -1}}]], Graphics[Rectangle[]]}] SwatchLegend[ 63, Range[3], LegendMarkers -> {{"\[FilledCircle]", #}, {"\[FilledDiamond]", #}, \ {"\[FilledSquare]", #}}] & [13.5] ...


2

There is no one-to-one equivalence because font glyphs and Graphics primitives are not rendered the same way. Essentially 22 in {"\[FilledCircle]", 22} is a font size whereas LegendMarkerSize is set as ImageSize which is in screen pixels. The issue then it to scale font size to fill a given pixel width which is a known difficult problem in Mathematica. ...


3

You may also supply EdgeForm[] in Graphics[...] to force Mathematica not to draw edges.



Top 50 recent answers are included