WLJS LogoWLJS Notebook

SwatchLegend

SwatchLegend[{col1, ...}, {lbl1, ...}] generates a legend that associates swatches of colors coli with labels lbli.

  • SwatchLegend[{col1, ...}, Automatic] generates a legend with placeholder labels for the colors coli.
  • SwatchLegend[{lbl1, ...}] represents a legend with inherited colors within visualization functions.

Examples

Create a color swatch legend:

SwatchLegend[{Red, Green, Blue}, {"Low", "Medium", "High"}]

Use with a plot:

BarChart[{1, 2, 3}, ChartLegends -> SwatchLegend[{"A", "B", "C"}]]

Please visit the official Wolfram Language Reference for more details.

On this page