Method legend
| Improve this Doc View Sourcelegend(out Double, out Double, Legend, Position, Double, Double, Double, Int32, Int32, LineStyle, Int32, Int32, LegendEntry[], Double, Double, Double, Double, Int32[], String[], Int32[], Pattern[], Double[], Double[], Int32[], LineStyle[], Double[], Int32[], Double[], Int32[], String[])
pllegend: Plot legend using discretely annotated filled boxes, lines, and/or lines of symbols
Declaration
public static void legend(out Double p_legend_width, out Double p_legend_height, Legend opt, Position position, Double x, Double y, Double plot_width, Int32 bg_color, Int32 bb_color, LineStyle bb_style, Int32 nrow, Int32 ncolumn, LegendEntry[] opt_array, Double text_offset, Double text_scale, Double text_spacing, Double text_justification, Int32[] text_colors, String[] text, Int32[] box_colors, Pattern[] box_patterns, Double[] box_scales, Double[] box_line_widths, Int32[] line_colors, LineStyle[] line_styles, Double[] line_widths, Int32[] symbol_colors, Double[] symbol_scales, Int32[] symbol_numbers, String[] symbols)
Parameters
Type | Name | Description |
---|---|---|
Double | p_legend_width | Returned value of the legend width in adopted coordinates. This quantity is calculated from plot_width, text_offset, ncolumn (possibly modified inside the routine depending on nlegend and nrow), and the length (calculated internally) of the longest text string. |
Double | p_legend_height | Returned value of the legend height in adopted coordinates. This quantity is calculated from text_scale, text_spacing, and nrow (possibly modified inside the routine depending on nlegend and nrow). |
Legend | opt | opt contains bits controlling the overall legend. If the PL_LEGEND_TEXT_LEFT bit is set, put the text area on the left of the legend and the plotted area on the right. Otherwise, put the text area on the right of the legend and the plotted area on the left. If the PL_LEGEND_BACKGROUND bit is set, plot a (semitransparent) background for the legend. If the PL_LEGEND_BOUNDING_BOX bit is set, plot a bounding box for the legend. If the PL_LEGEND_ROW_MAJOR bit is set and (both of the possibly internally transformed) nrow gt 1 and ncolumn gt 1, then plot the resulting array of legend entries in row-major order. Otherwise, plot the legend entries in column-major order. |
Position | position | position contains bits which control the overall position of the legend and the definition of the adopted coordinates used for positions just like what is done for the position argument for plcolorbar. However, note that the defaults for the position bits (see below) are different than the plcolorbar case. The combination of the PL_POSITION_LEFT, PL_POSITION_RIGHT, PL_POSITION_TOP, PL_POSITION_BOTTOM, PL_POSITION_INSIDE, and PL_POSITION_OUTSIDE bits specifies one of the 16 possible standard positions (the 4 corners and centers of the 4 sides for both the inside and outside cases) of the legend relative to the adopted coordinate system. The corner positions are specified by the appropriate combination of two of the PL_POSITION_LEFT, PL_POSITION_RIGHT, PL_POSITION_TOP, and PL_POSITION_BOTTOM bits while the sides are specified by a single value of one of those bits. The adopted coordinates are normalized viewport coordinates if the PL_POSITION_VIEWPORT bit is set or normalized subpage coordinates if the PL_POSITION_SUBPAGE bit is set. Default position bits: If none of PL_POSITION_LEFT, PL_POSITION_RIGHT, PL_POSITION_TOP, or PL_POSITION_BOTTOM are set, then use the combination of PL_POSITION_RIGHT and PL_POSITION_TOP. If neither of PL_POSITION_INSIDE or PL_POSITION_OUTSIDE is set, use PL_POSITION_INSIDE. If neither of PL_POSITION_VIEWPORT or PL_POSITION_SUBPAGE is set, use PL_POSITION_VIEWPORT. |
Double | x | X offset of the legend position in adopted coordinates from the specified standard position of the legend. For positive x, the direction of motion away from the standard position is inward/outward from the standard corner positions or standard left or right positions if the PL_POSITION_INSIDE/PL_POSITION_OUTSIDE bit is set in position. For the standard top or bottom positions, the direction of motion is toward positive X. |
Double | y | Y offset of the legend position in adopted coordinates from the specified standard position of the legend. For positive y, the direction of motion away from the standard position is inward/outward from the standard corner positions or standard top or bottom positions if the PL_POSITION_INSIDE/PL_POSITION_OUTSIDE bit is set in position. For the standard left or right positions, the direction of motion is toward positive Y. |
Double | plot_width | Horizontal width in adopted coordinates of the plot area (where the colored boxes, lines, and/or lines of symbols are drawn) of the legend. |
Int32 | bg_color | The cmap0 color of the background for the legend (PL_LEGEND_BACKGROUND). |
Int32 | bb_color | The cmap0 color of the bounding-box line for the legend (PL_LEGEND_BOUNDING_BOX). |
LineStyle | bb_style | The pllsty style number for the bounding-box line for the legend (PL_LEGEND_BACKGROUND). |
Int32 | nrow | The cmap0 index of the background color for the legend (PL_LEGEND_BACKGROUND). |
Int32 | ncolumn | The cmap0 index of the background color for the legend (PL_LEGEND_BACKGROUND). |
LegendEntry[] | opt_array | A vector of nlegend values of options to control each individual plotted area corresponding to a legend entry. If the PL_LEGEND_NONE bit is set, then nothing is plotted in the plotted area. If the PL_LEGEND_COLOR_BOX, PL_LEGEND_LINE, and/or PL_LEGEND_SYMBOL bits are set, the area corresponding to a legend entry is plotted with a colored box; a line; and/or a line of symbols. |
Double | text_offset | Offset of the text area from the plot area in units of character width. N.B. The total horizontal width of the legend in adopted coordinates is calculated internally from plot_width (see above), text_offset, and length (calculated internally) of the longest text string. |
Double | text_scale | Character height scale for text annotations. N.B. The total vertical height of the legend in adopted coordinates is calculated internally from nlegend (see above), text_scale, and text_spacing (see below). |
Double | text_spacing | Vertical spacing in units of the character height from one legend entry to the next. N.B. The total vertical height of the legend in adopted coordinates is calculated internally from nlegend (see above), text_scale (see above), and text_spacing. |
Double | text_justification | Justification parameter used for text justification. The most common values of text_justification are 0., 0.5, or 1. corresponding to a text that is left justified, centred, or right justified within the text area, but other values are allowed as well. |
Int32[] | text_colors | A vector containing nlegend cmap0 text colors. |
String[] | text | A vector of nlegend UTF-8 character strings containing the legend annotations. |
Int32[] | box_colors | A vector containing nlegend cmap0 colors for the discrete colored boxes (PL_LEGEND_COLOR_BOX). |
Pattern[] | box_patterns | A vector containing nlegend patterns (plpsty indices) for the discrete colored boxes (PL_LEGEND_COLOR_BOX). |
Double[] | box_scales | A vector containing nlegend scales (units of fraction of character height) for the height of the discrete colored boxes (PL_LEGEND_COLOR_BOX). |
Double[] | box_line_widths | A vector containing nlegend line widths for the patterns specified by box_patterns (PL_LEGEND_COLOR_BOX). |
Int32[] | line_colors | A vector containing nlegend cmap0 line colors (PL_LEGEND_LINE). |
LineStyle[] | line_styles | A vector containing nlegend line styles (plsty indices) (PL_LEGEND_LINE). |
Double[] | line_widths | A vector containing nlegend line widths (PL_LEGEND_LINE). |
Int32[] | symbol_colors | A vector containing nlegend cmap0 symbol colors (PL_LEGEND_SYMBOL). |
Double[] | symbol_scales | A vector containing nlegend scale values for the symbol height (PL_LEGEND_SYMBOL). |
Int32[] | symbol_numbers | A vector containing nlegend numbers of symbols to be drawn across the width of the plotted area (PL_LEGEND_SYMBOL). |
String[] | symbols | A vector of nlegend UTF-8 character strings containing the legend symbols. (PL_LEGEND_SYMBOL). |
Remarks
Routine for creating a discrete plot legend with a plotted filled box, line, and/or line of symbols for each annotated legend entry. (See plcolorbar for similar functionality for creating continuous color bars.) The arguments of pllegend provide control over the location and size of the legend as well as the location and characteristics of the elements (most of which are optional) within that legend. The resulting legend is clipped at the boundaries of the current subpage. (N.B. the adopted coordinate system used for some of the parameters is defined in the documentation of the position parameter.)