These functions draw legend to the graph (useful for 1D plotting). Legend entry is a pair of strings: one for style of the line, another one with description text (with included TeX parsing). The arrays of strings may be used directly or by accumulating first to the internal arrays (by function addlegend) and further plotting it. The position of the legend can be selected automatic or manually (even out of bounding box). Parameters fnt and size specify the font style and size (see Font settings). Option value
set the relative width of the line sample and the text indent. If line style string for entry is empty then the corresponding text is printed without indent. Parameter fnt may contain:
See Legend sample, for sample code and picture.
[pos=3
'fnt'='#']
¶mglGraph
: void
Legend (int
pos=0x3
, const char *
fnt="#"
, const char *
opt=""
)
¶void
mgl_legend (HMGL
gr, int
pos, const char *
fnt, const char *
opt)
¶Draws legend of accumulated legend entries by font fnt with size. Parameter pos sets the position of the legend: ‘0’ is bottom left corner, ‘1’ is bottom right corner, ‘2’ is top left corner, ‘3’ is top right corner (is default). Option value
set the space between line samples and text (default is 0.1).
x y
['fnt'='#']
¶mglGraph
: void
Legend (mreal
x, mreal
y, const char *
fnt="#"
, const char *
opt=""
)
¶void
mgl_legend_pos (HMGL
gr, mreal
x, mreal
y, const char *
fnt, const char *
opt)
¶Draws legend of accumulated legend entries by font fnt with size. Position of legend is determined by parameter x, y which supposed to be normalized to interval [0,1]. Option value
set the space between line samples and text (default is 0.1).
'text' 'stl'
¶mglGraph
: void
AddLegend (const char *
text, const char *
style)
¶mglGraph
: void
AddLegend (const wchar_t *
text, const char *
style)
¶void
mgl_add_legend (HMGL
gr, const char *
text, const char *
style)
¶void
mgl_add_legendw (HMGL
gr, const wchar_t *
text, const char *
style)
¶Adds string text to internal legend accumulator. The style of described line and mark is specified in string style (see Line styles).
mglGraph
: void
ClearLegend ()
¶void
mgl_clear_legend (HMGL
gr)
¶Clears saved legend strings.