manpagez: man pages & more
info mathgl_en
Home | html | info | man
[ << ] [ < ] [ 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:

See section Legend sample, for sample code and picture.

MGL command: legend [pos=3 'fnt'='#' size=-0.8 llen=0.1]
Method on mglGraph: void Legend (int pos=0x3, const char *fnt="#", float size=-0.8, float llen=0.1)
C function: void mgl_legend (HMGL gr, int pos, const char *fnt, float size, float llen)

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.

MGL command: legend x y ['fnt'='#' size=-1 llen=0.1]
Method on mglGraph: void Legend (float x, float y, const char *fnt="#", float size=-0.8, float llen=0.1)
C function: void mgl_legend_pos (HMGL gr, float x, float y, const char *fnt, float size, float llen)

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].

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 April 13, 2012 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.