New answers tagged

2

If you are using Mathematica version 9.0 or later, you can use the PlotLegends option as shown in the documentation and in Lukas's answer (beat me to it by 2 minutes). But if you are using an older version you have to resort to the PlotLegends package (I know it's confusing), << PlotLegends` With[{arrayData = Array[Sin[.01 π (#1 - 2 #2)] &, {100, ...


3

This is how you add a color legend to your ListContourPlot (also true for similar types of plots). This is by the way the third example in the ListContourPlot documentation. Of course, the crucial part is the PlotLegends option. data = Table[{x = RandomReal[{-2, 2}], y = RandomReal[{-2, 2}], Sin[x y]}, 1000}]; ListContourPlot[ data, ColorFunction -> ...


4

Plot[{3 x, 5 x, 7 x, 9 x}, {x, -1, 1}, PlotLegends -> Placed[LineLegend[Row[{Style["K", 23, Italic], Style["=" <> ToString@#, 23]}] & /@ {3, 5, 7, 9}], {After, Top}]] Or, use PlotLegends -> Placed[LineLegend[ Style[ToString[Style[K, Italic], StandardForm] <> "=" <> ToString[#], 23] & /@ {3, 5, 7, ...


1

Took me a while to figure it out myself. The co-ordinates are: { {Position on graphic in x, Position on graphic in y}, {Part of plot legend that should be at the assigned position on graphic} } So: {{0.9, 0.9}, {1, 1}} assigns a location on my graphic 90% up the graphic and 90% to the right, and puts the upper right corner of my plot legend at this ...


4

Okay, so the mantra around here is "Don't use the PlotLegends package." Keep repeating that until you can resist the urge. Here I'll just use Inset to place a LineLegend inside the frame, and I'll use the options for LineLegend to make the lines ridiculously long for example, Show[plot1, plot2, Frame -> True, FrameLabel -> {{"data1,data2", ...



Top 50 recent answers are included