legend — draw graph legend
hl=legend([h,] string1,string2, ... [,pos] [,boxed]) hl=legend([h,] strings [,pos] [,boxed])
graphic handle on an Axes entity or vector of handles on
polyline entities. The default value is the handle on
current_axes
.
character strings stringsi is the legend of the ith curve
n vector of strings, strings(i) is the legend of the ith curve
(optional) specify where to draw the legend; this parameter may be a integer flag (or equivalently a string flag) or a vector [x,y] which gives the coordinates of the upper left corner of the legend box. In the first case the possible values are:
the legend is drawn in the upper right-hand corner (default).
the legend is drawn in the upper left-hand corner.
the legend is drawn in the lower left-hand corner.
the legend is drawn in the lower right-hand corner.
interactive placement with the mouse .
the legend is drawn at the right of the upper right-hand corner.
the legend is drawn at the left of the upper left-hand corner.
the legend is drawn at the left of the lower left-hand corner.
the legend is drawn at the right of the lower right-hand corner.
the legend is drawn above the upper left-hand corner.
the legend is drawn below the lower left-hand corner.
a boolean (default value %t) which sets ot not the drawing of the box.
a handle, points to the Compound containing all the legend .
Puts a legend on the current plot using the specified strings as labels. legend prepends labels by a recall of the corresponding line or patch. The recall type and properties are recovered from the given handles:
when called without handle argument (or with a handle on a axes entity) the function first build the vectors of handle on polylines entities which are the children of the given axes.
In the interactive placement mode (opt=5) move the legend box with the mouse and press the left button to release it.
t=linspace(0,%pi,20); a=gca();a.data_bounds=[t(1) -1.8;t($) 1.8]; plot2d(t,[cos(t'),cos(2*t'),cos(3*t')],[-5,2 3]); e=gce(); e1=e.children(1);e1.thickness=2;e1.polyline_style=4;e1.arrow_size_factor = 1/2; e.children(2).line_style=4; e3=e.children(3);e3.line_mode='on';e3.mark_background=5; hl=legend(['cos(t)';'cos(2*t)';'cos(3*t)']);