FUNCTION REFERENCE
legend
Show a legend.
Show a legend.
Syntax
legendSyntax
legend('sin', 'cos')Syntax
legend('sin', 'cos', 'Location', 'northeast')A legend handle exposes Title as a text handle; h.Title.String edits its heading, with FontWeight, FontSize, Color, Interpreter and Visible properties. Labels are given in series order, one per series. Interpreter defaults to tex; none draws source text literally and latex renders a $...$ / $$...$$ math subset. 'on' and 'off' show or hide it. Location accepts the eight compass points, outside variants, 'best' and 'bestoutside'. Supports NumColumns (positive integer, row-major), Orientation ('vertical' or 'horizontal'), Box ('on' or 'off'), Color (color name, RGB or 'none'), TextColor (color name or RGB) and EdgeColor (color name, RGB or 'none').
Example
plot(1:3,1:3); hold on; plot(1:3,[3 2 1]); legend('sin','cos') % labels both seriesDifferences from MATLAB: The label count must equal the series count. Some graphics-handle forms are limited.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.