Tag Info

New answers tagged

11

We may observe that the automatically generated legend limits the number of legend items to the number of available colors in the given color scheme. Using this utility function: plot[scheme_] := Plot[Evaluate[Range[20] + x], {x, -5, 5}, PlotLegends -> "Expressions", PlotStyle -> scheme] Observe the result for indexed color scheme #42 which has ...


1

Mathematica uses the style environment specified by the ScreenStyleEnvironment FrontEnd option for on-screen rendering and Exporting into raster formats but for printing and Exporting into PostScript formats it uses the style environment specified by the PrintingStyleEnvironment option. They have different values by default: Options[$FrontEnd, ...


4

If it is to be printed and you have space (say, a page), then a grid can be effective, where each dataset is plotted in a highlight color over a monochromatic plot of all datasets: maxmin = {Min /@ Transpose[data], Max /@ Transpose[data]}; background = ListLinePlot[Join[maxmin, data], PlotStyle -> Directive[Thin, Gray], Filling -> {1 -> ...


2

Assuming you really want solid lines for your data, I'd suggest something like the following. ListLinePlot[fakedata, PlotStyle -> (Flatten@ Outer[Directive, {AbsoluteThickness[1.5], Dashing[0.02], DotDashed, Dotted}, Take[ColorData[22, "ColorList"], 5]])] For shorter data series in the data set, PlotMarkers can help if you truncate your ...


2

How do I modify my code or otherwise work around this issue? Using Scaled in the last argument of Placed seems to fix the issue: DensityPlot[.015 Sin[x + y], {x, 0, Pi}, {y, 0, Pi}, ColorFunction -> "Rainbow", ImageSize -> 500, Frame -> False, Axes -> True, AxesLabel -> {"\!\(\*SubscriptBox[\(k\), \(z\)]\)", "\!\(\*SubscriptBox[\(k\), ...


0

Fairly close to what you're after. For version 7 use ColorData[1, ...] for the right colour set. Needs["PlotLegends`"]; ShowLegend[Plot[{x, x^2, x^3}, {x, 0, 3}, Frame -> True, ImageSize -> 500], {{{Graphics[{ColorData[97, 1], Thick, Line[{{0, 0}, {8, 0}}]}], Style["long text 1", 12, FontFamily -> "Helvetica"]}, {Graphics[{ColorData[97, ...


1

You forgot to include an Evaluate: Plot[Evaluate@Table[f[[i]][x], {i, 1, 2}], {x, 0, 2 Pi}, PlotStyle -> {Red, Blue}, PlotLegends -> "AllExpressions"] which produces the correct result: In general, if you are trying to Plot a Table in one step, you should always Evaluate the Table first, ie, Plot[Evaluate@Table[...], ...]. Brief explanation of ...


3

If you look under the documentation for LegendMarkerSize, you will see it accepts values of the form: {w, h}. So, you can specify the width, for example BarLegend["Rainbow", LegendMarkerSize -> {100, 100}]


3

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}}], ...


6

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 -> ...


31

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 ...



Top 50 recent answers are included