Skip to content

legend

plot · scripts/plot/appearance/legend.m

: lgd = legend ()
: lgd = legend (label1, …, labelN)
: lgd = legend (label1, …)
: lgd = legend (h, …)
: lgd = legend (ax, …)
: legend (option)
: lgd = legend (…, prop, val, …)

Create, update or control the legend of an axes.

A legend is an axes object with the tag "legend" that is a child of the figure. There is at most one per axes; calling legend again updates it. Labels are given in the order the plotted objects were created; without labels the "DisplayName" of each object is used. A vector h of plotted objects restricts the legend to those objects.

option is one of "off" (delete the legend), "hide", "show", "toggle", "boxoff" and "boxon".

Name/value pairs: "Location" ("north", "southeast", "northoutside", "best", "bestoutside", …), "Orientation", "NumColumns", "Box", "FontSize" and "Interpreter" are checked; other known names ("FontName", "TextColor", "EdgeColor", "Color", "Title", "Visible") are stored. The entries, location and options are kept with the legend object; no rendering takes place in a headless session.