PlotLegends
is an option for plot functions that specifies what legends to use.
Details
- Typical settings for PlotLegends include:
-
None add no legend Automatic use automatic legending "Expressions" use formulas as legend labels {lbl1,lbl2,…} use lbli for the i input expr use expr as legend Placed[leg,pos] specify placement of legend - The following legend constructors can be used to form commonly occurring legends: SwatchLegend, LineLegend, PointLegend and BarLegend.
- PlotLegendsPlaced[leg,pos] places the legend leg at the position specified by pos.
- Possible forms for pos are:
-
Above,Below,Before,After positions outside the bounding box for expr {h,v} horizontal h and vertical positions v {{ex,ey},{lx,ly}} scaled position {lx,ly} in the legend at scaled position {ex,ey} in expr - Possible horizontal positions include Before, Left, Center, Right and After.
- Possible vertical positions include Below, Bottom, Center, Top and Above.
Examples
open allclose allBasic Examples (5)
Scope (5)
Legend Content (2)
Use LineLegend to construct a legend:
Use SwatchLegend to construct a legend:
BarLegend is used in ContourPlot and DensityPlot:
Use SwatchLegend to construct a legend:
Legend Placement (3)
Use Placed to change legend placement:
Use named horizontal and vertical positions to place a legend:
Use scaled coordinates associated with plot range to place a legend:
For fine-control legend placement, specify the position where a legend should be placed:
Possible Issues (1)
Control variables in Manipulate are shown in legend with full context due to the HoldForm:
Use With to show the variable value:
Text
Wolfram Research (2012), PlotLegends, Wolfram Language function, https://reference.wolfram.com/language/ref/PlotLegends.html.
CMS
Wolfram Language. 2012. "PlotLegends." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/PlotLegends.html.
APA
Wolfram Language. (2012). PlotLegends. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PlotLegends.html