legend properties
legend graphics object properties.
📄Description

This page documents the visible properties returned by properties for a legend graphics object.

Property Action Type and supported values
Title updates the displayed title or the title object associated with the graphics item. Type: text graphics object or text value, depending on the object class. Supported values: a title text object, character row vector, string scalar, or empty text.
AutoUpdate updates rendered output on the next graphics refresh. Type: on/off value. Supported values: 'on', 'off', true, or false.
Box updates rendered output on the next graphics refresh. Type: on/off value. Supported values: 'on', 'off', true, or false.
BackgroundAlpha updates rendered output on the next graphics refresh. Type: numeric scalar or numeric array. Supported values: values in [0,1]; data arrays must match the related rendered data.
Color updates rendered output on the next graphics refresh. Type: color value. Supported values: 'red'/'r', 'green'/'g', 'blue'/'b', 'cyan'/'c', 'magenta'/'m', 'yellow'/'y', 'black'/'k', 'white'/'w', RGB triplet [r g b] with values in [0,1], or hexadecimal color '#RRGGBB'/'#RGB'.
EdgeColor updates rendered output on the next graphics refresh. Type: color value or color mode keyword. Supported values: 'red'/'r', 'green'/'g', 'blue'/'b', 'cyan'/'c', 'magenta'/'m', 'yellow'/'y', 'black'/'k', 'white'/'w', RGB triplet [r g b] with values in [0,1], or hexadecimal color '#RRGGBB'/'#RGB', 'none', 'flat', 'interp'.
FontName updates rendered output on the next graphics refresh. Type: text scalar or character row vector. Supported values: a system font name or 'FixedWidth'.
FontSize recomputes geometry, limits, or layout. Type: finite numeric scalar. Supported values: finite scalar value.
FontAngle updates rendered output on the next graphics refresh. Type: text scalar or character row vector. Supported values: 'normal', 'italic'.
FontWeight updates rendered output on the next graphics refresh. Type: text scalar or character row vector. Supported values: 'normal', 'bold'.
Interpreter updates rendered output on the next graphics refresh. Type: text scalar or character row vector. Supported values: 'tex', 'none'.
ItemHitFcn the graphics event system invokes it for the associated event. Type: callback value. Supported values: [], function handle, character vector, string scalar, or callback cell array.
LineWidth updates rendered output on the next graphics refresh. Type: finite numeric scalar. Supported values: value greater than or equal to 0.
Location recomputes geometry, limits, or layout. Type: text scalar or character row vector. Supported values: 'north', 'south', 'east', 'west', 'northoutside', 'southoutside', 'eastoutside', 'westoutside', 'best', 'none', 'layout', 'manual'.
NumColumns updates the stored object state. Type: integer scalar or numeric vector. Supported values: finite integer value, finite numeric value, or vector required by the property.
NumColumnsMode 'auto' lets Nelson recompute the paired property; 'manual' preserves the assigned value. Type: text scalar or character row vector. Supported values: 'auto', 'manual'.
Orientation recomputes geometry, limits, or layout. Type: text scalar or character row vector. Supported values: 'vertical', 'horizontal'.
IconColumnWidth updates rendered output on the next graphics refresh. Type: text scalar, image array, or empty array. Supported values: [] , image path, or image data.
IconColumnWidthMode 'auto' lets Nelson recompute the paired property; 'manual' preserves the assigned value. Type: text scalar or character row vector. Supported values: 'auto', 'manual'.
Direction updates rendered output on the next graphics refresh. Type: text scalar or character row vector. Supported values: 'normal', 'reverse'.
DirectionMode 'auto' lets Nelson recompute the paired property; 'manual' preserves the assigned value. Type: text scalar or character row vector. Supported values: 'auto', 'manual'.
Position recomputes geometry, limits, or layout. Type: finite numeric vector. Supported values: finite vector with the documented size, such as [left bottom width height], [x y z], [azimuth elevation], or [minor major].
String updates displayed text content. Type: text value. Supported values: character row vector, string scalar, string array, or cell array of character row vectors.
TextColor updates rendered output on the next graphics refresh. Type: color value. Supported values: 'red'/'r', 'green'/'g', 'blue'/'b', 'cyan'/'c', 'magenta'/'m', 'yellow'/'y', 'black'/'k', 'white'/'w', RGB triplet [r g b] with values in [0,1], or hexadecimal color '#RRGGBB'/'#RGB'.
Units recomputes geometry, limits, or layout. Type: text scalar or character row vector. Supported values: 'pixels', 'normalized', 'inches', 'centimeters', 'points', 'characters', 'data'.
Children parenting operations update the vector. Type: graphics object handle vector. Supported values: empty vector or child handles.
Parent reparents the object and updates Children on the old and new parents. Type: graphics object handle scalar. Supported values: a valid parent handle for the object class.
Visible updates rendered output on the next graphics refresh. Type: text scalar or character row vector. Supported values: 'on', 'off'.
HandleVisibility controls whether handle-search functions can find the object. Type: text scalar or character row vector. Supported values: 'on', 'off', 'callback'.
ButtonDownFcn runs when the object receives a mouse-button event. Type: callback value. Supported values: [], function handle, character vector, string scalar, or callback cell array.
ContextMenu attaches the menu used for context-click actions. Type: graphics object handle scalar. Supported values: [] or a uicontextmenu handle.
BusyAction controls whether an interrupting callback is queued or canceled. Type: text scalar or character row vector. Supported values: 'queue', 'cancel'.
BeingDeleted Nelson computes this value; graphics operations update it. Type: text scalar or character row vector. Supported values: 'off', 'on'.
Interruptible controls whether a running callback can be interrupted. Type: text scalar or character row vector. Supported values: 'on', 'off'.
CreateFcn runs when the object is created. Type: callback value. Supported values: [], function handle, character vector, string scalar, or callback cell array.
DeleteFcn runs when the object is deleted. Type: callback value. Supported values: [], function handle, character vector, string scalar, or callback cell array.
Type Nelson computes this value; graphics operations update it. Type: text scalar or character row vector. Supported values: read-only object type name, for example 'figure', 'axes', 'line', or 'scatter'.
Tag updates the stored object state. Type: text scalar or character row vector. Supported values: empty text or an object identifier.
UserData updates the stored object state. Type: Nelson array. Supported values: any Nelson value, including [], numeric arrays, text, cells, structures, or handles.
Selected updates rendered output on the next graphics refresh. Type: text scalar or character row vector. Supported values: 'on', 'off'.
SelectionHighlight updates rendered output on the next graphics refresh. Type: text scalar or character row vector. Supported values: 'on', 'off'.
HitTest includes or excludes the object from mouse hit testing. Type: text scalar or character row vector. Supported values: 'on', 'off'.
PickableParts selects which visible or invisible parts can receive mouse hits. Type: text scalar or character row vector. Supported values: 'visible', 'all', 'none'.
Layout updates the object placement requested from the parent layout manager. Type: layout options object or empty value. Supported values: layout information stored by parent layout managers, including tile placement data where the object supports tiled layouts.
💡Examples
Create the graphics object and list its properties.
f = figure('Visible', 'off');
ax = axes('Parent', f);
plot(ax, 1:3, 1:3, 'DisplayName', 'line');
h = legend(ax, {'line'});
names = properties(h);
close(f)
🔗See Also
legendpropertiesgetset
🕔Version History
Version Description
-- Property page added.
Edit this page on GitHub