[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
4.9 Legend
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). Parameter llen 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:
- font style for legend text;
- ‘A’ for positioning in absolute coordinates;
- ‘^’ for positioning outside of specified point;
- ‘#’ for drawing box around legend;
- colors for background (first one) and border (second one) of legend. Note, that last color is always used as color for legend text.
See section Legend sample, for sample code and picture.
- MGL command: legend [
pos=3
'fnt'='#'] - Method on
mglGraph
:void
Legend (int
pos=0x3
,const char *
fnt="#"
,const char *
opt=""
) - C function:
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). Parameter fnt can contain colors for face (1st one), for border (2nd one) and for text (last one). If less than 3 colors are specified then the color for border is black (for 2 and less colors), and the color for face is white (for 1 or none colors). If string fnt contain ‘#’ then border around the legend is drawn. If string fnt contain ‘-’ then legend entries will arranged horizontally. Option
value
set the space between line samples and text (default is 0.1).
- MGL command: legend
x y
['fnt'='#'] - Method on
mglGraph
:void
Legend (mreal
x,mreal
y,const char *
fnt="#"
,const char *
opt=""
) - C function:
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).
- MGL command: addlegend 'text' 'stl'
- Method on
mglGraph
:void
AddLegend (const char *
text,const char *
style) - Method on
mglGraph
:void
AddLegend (const wchar_t *
text,const char *
style) - C function:
void
mgl_add_legend (HMGL
gr,const char *
text,const char *
style) - C function:
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).
- MGL command: clearlegend
- Method on
mglGraph
:void
ClearLegend () - C function:
void
mgl_clear_legend (HMGL
gr) Clears saved legend strings.
- MGL command: legendmarks
val
- Method on
mglGraph
:void
SetLegendMarks (int
num) - C function:
void
mgl_set_legend_marks (HMGL
gr,int
num) Set the number of marks in the legend. By default 1 mark is used.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on March 21, 2014 using texi2html 5.0.