LegendSpacing
is an option for Legend that specifies the amount of space around each key box on a scale where the box is 1.
LegendSpacing
LegendSpacing
is an option for Legend that specifies the amount of space around each key box on a scale where the box is 1.
Details and Options
- To use LegendSpacing, you first need to load the Plot Legends Package using Needs["PlotLegends`"].
- The following settings can be given:
-
n a number Automatic determine spacing automatically - For the boxes to be adjacent (a continuous line, for instance), LegendSpacing should be set to 0.
Examples
Basic Examples (1)
Needs["PlotLegends`"]Normally spaced keys in the legend:
Plot[{Sin[x], Cos[x]}, {x, 0, 2Pi}, PlotLegend -> {"sine", "cosine"}, LegendSpacing -> 0]Increasing the value of LegendSpacing increases the distance between the keys in the legend:
Plot[{Sin[x], Cos[x]}, {x, 0, 2Pi}, PlotLegend -> {"sine", "cosine"}, LegendSpacing -> 0.2]Tech Notes
Related Guides
Text
Wolfram Research (2007), LegendSpacing, Wolfram Language function, https://reference.wolfram.com/language/PlotLegends/ref/LegendSpacing.html.
CMS
Wolfram Language. 2007. "LegendSpacing." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/PlotLegends/ref/LegendSpacing.html.
APA
Wolfram Language. (2007). LegendSpacing. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/PlotLegends/ref/LegendSpacing.html
BibTeX
@misc{reference.wolfram_2026_legendspacing, author="Wolfram Research", title="{LegendSpacing}", year="2007", howpublished="\url{https://reference.wolfram.com/language/PlotLegends/ref/LegendSpacing.html}", note=[Accessed: 15-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_legendspacing, organization={Wolfram Research}, title={LegendSpacing}, year={2007}, url={https://reference.wolfram.com/language/PlotLegends/ref/LegendSpacing.html}, note=[Accessed: 15-June-2026]}