PointLegend

PointLegend[{col1,},{lbl1,}]

generates a legend that associates points of colors coli with labels lbli.

PointLegend[{col1,},Automatic]

generates a legend with placeholder labels for the colors coli.

PointLegend[{lbl1,}]

represents a legend with inherited colors within visualization functions.

Details and Options

  • PointLegend uses a point with color coli to identify label lbli with elements in a visualization or other legended item.
  • Legended[expr,PointLegend[]] can be used to apply a legend to an arbitrary expression expr.
  • The following options can be given:
  • Joined Falsewhether to draw a joined line with the points
    LabelStyle Automaticstyle to use for labels
    LegendFunction Identitywrapper for the overall legend
    LegendLabel Noneoverall label for legend
    LegendLayout Automaticlegend layout to use
    LegendMargins Automaticspace between legend content and boundaries
    LegendMarkers Noneshape of each point
    LegendMarkerSize Automaticsize of the shape
  • PointLegend is displayed in StandardForm as a table. In InputForm, it is displayed as an explicit list of colors and labels.
  • In PointLegend, LegendLayout can have the following forms:
  • Automaticautomatically determine layout
    "Row"display legend in a horizontal row
    "Column"display legend in a vertical column
    "ReversedRow"display reversed legend in a horizontal row
    "ReversedColumn"display reversed legend in a vertical column
    fapply f to construct the legend
  • The layout specification f is applied to the table of values {{col1,lbl1},} to generate the legend.
  • LegendFunction is applied to the legend, including any overall label and margins.

Examples

open allclose all

Basic Examples  (3)

A list of styles and labels:

Use placeholder labels:

PointLegend is used to automatically create legends for ListPlot:

Customize the appearance of the legend:

Scope  (14)

Styles and Labels  (9)

Use style primitives:

Use with markers:

Use Directive to combine directives in a style:

PointLegend uses the shorter list of styles and labels:

Use indexed colors:

Use gradient color schemes:

Use Placeholder labels:

PointLegend remains unevaluated in other cases:

PointLegend normally displays in tabular form:

InputForm shows a textual form:

Presentation  (5)

PointLegend line wraps automatically:

PointLegend automatically picks up styles when used in plots:

PointLegend automatically picks up PlotMarkers:

Change the default look of PointLegend and the position:

Use Legended to legend Graphics with PointLegend:

Options  (28)

Joined  (4)

By default, no lines are drawn:

Joined->Automatic matches the behavior of the plot:

Joined->True always draws lines:

Joined can take a list of values:

LabelStyle  (3)

All labels have the same default style:

Specify styles for labels:

LabelStyle applies to LegendLabel:

LegendFunction  (4)

Use a stylized frame:

Use Panel:

Use a customized frame:

Create a legend with a drop shadow:

LegendLabel  (5)

Add an overall label to the legend:

The label from LegendLabel is included in the argument to LegendFunction:

Construct a LegendFunction using Labeled that has a label outside:

Use LabelStyle to style a legend label:

Use Placed to change the legend label position:

Use the third argument in Placed to rotate the legend label:

LegendLayout  (4)

Arrange the legend in a row:

Arrange the legend in a column:

Reverse the direction of the legend:

Write a function to construct the legend as a formatted table:

LegendMargins  (3)

Leave no space between the legend content and any boundaries from LegendFunction:

Specify a margin around the content:

Use different margins on different sides:

LegendMarkers  (3)

By default, points are drawn:

LegendMarkers->Automatic matches the markers used by the plot:

Specify a shape to use:

LegendMarkerSize  (2)

Specify the size of legend items in every direction:

Specify sizes for the width and height:

Wolfram Research (2012), PointLegend, Wolfram Language function, https://reference.wolfram.com/language/ref/PointLegend.html.

Text

Wolfram Research (2012), PointLegend, Wolfram Language function, https://reference.wolfram.com/language/ref/PointLegend.html.

CMS

Wolfram Language. 2012. "PointLegend." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/PointLegend.html.

APA

Wolfram Language. (2012). PointLegend. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PointLegend.html

BibTeX

@misc{reference.wolfram_2023_pointlegend, author="Wolfram Research", title="{PointLegend}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/PointLegend.html}", note=[Accessed: 28-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_pointlegend, organization={Wolfram Research}, title={PointLegend}, year={2012}, url={https://reference.wolfram.com/language/ref/PointLegend.html}, note=[Accessed: 28-March-2024 ]}