PLplot: pllegend.c File Reference

PLplot 5.15.0

Macros | Functions
pllegend.c File Reference
`#include "plplotP.h"`

Go to the source code of this file.

## Macros
#define | adopted_to_subpage_x(nx) ( ( xdmin_adopted ) + ( nx ) * ( ( xdmax_adopted ) - ( xdmin_adopted ) ) )
#define | subpage_to_adopted_x(nx) ( ( nx - xdmin_adopted ) / ( ( xdmax_adopted ) - ( xdmin_adopted ) ) )
#define | adopted_to_subpage_y(ny) ( ( ydmin_adopted ) + ( ny ) * ( ( ydmax_adopted ) - ( ydmin_adopted ) ) )
#define | subpage_to_adopted_y(ny) ( ( ny - ydmin_adopted ) / ( ( ydmax_adopted ) - ( ydmin_adopted ) ) )
#define | max_opts 25

## Functions
static void | plgvpsp (PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax)
static void | legend_position (PLINT position, PLFLT legend_width, PLFLT legend_height, PLFLT *x_legend_position, PLFLT *y_legend_position, PLFLT *xsign, PLFLT *ysign)
static void | get_subpage_per_mm (PLFLT *x_subpage_per_mm, PLFLT *y_subpage_per_mm)
static PLFLT | get_character_or_symbol_height (PLBOOL ifcharacter)
void | c_pllegend (PLFLT *p_legend_width, PLFLT *p_legend_height, PLINT opt, PLINT position, PLFLT x, PLFLT y, PLFLT plot_width, PLINT bg_color, PLINT bb_color, PLINT bb_style, PLINT nrow, PLINT ncolumn, PLINT nlegend, PLINT_VECTOR opt_array, PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, PLFLT text_justification, PLINT_VECTOR text_colors, PLCHAR_MATRIX text, PLINT_VECTOR box_colors, PLINT_VECTOR box_patterns, PLFLT_VECTOR box_scales, PLFLT_VECTOR box_line_widths, PLINT_VECTOR line_colors, PLINT_VECTOR line_styles, PLFLT_VECTOR line_widths, PLINT_VECTOR symbol_colors, PLFLT_VECTOR symbol_scales, PLINT_VECTOR symbol_numbers, PLCHAR_MATRIX symbols)
static void | remove_characters (char *string, PLCHAR_VECTOR characters)
static void | draw_cap (PLBOOL if_edge, PLINT orientation, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT color)
static void | draw_box (PLBOOL if_bb, PLINT opt, PLCHAR_VECTOR axis_opts, PLBOOL if_edge, PLFLT ticks, PLINT sub_ticks, PLINT n_values, PLFLT_VECTOR values)
static void | draw_label (PLBOOL if_bb, PLINT opt, PLCHAR_VECTOR label)
static void | calculate_limits (PLINT position, PLFLT x, PLFLT y, PLFLT xdmin_adopted, PLFLT xdmax_adopted, PLFLT ydmin_adopted, PLFLT ydmax_adopted, PLFLT prior_bb_height, PLFLT *p_colorbar_width_bb, PLFLT *p_colorbar_height_bb, PLFLT *p_colorbar_width_ac, PLFLT *p_colorbar_height_ac, PLFLT *p_plot_x_subpage_bb, PLFLT *p_plot_y_subpage_bb, PLFLT *p_dx_subpage, PLFLT *p_dy_subpage)
void | c_plcolorbar (PLFLT *p_colorbar_width, PLFLT *p_colorbar_height, PLINT opt, PLINT position, PLFLT x, PLFLT y, PLFLT x_length, PLFLT y_length, PLINT bg_color, PLINT bb_color, PLINT bb_style, PLFLT low_cap_color, PLFLT high_cap_color, PLINT cont_color, PLFLT cont_width, PLINT n_labels, PLINT_VECTOR label_opts, PLCHAR_MATRIX labels, PLINT n_axes, PLCHAR_MATRIX axis_opts, PLFLT_VECTOR ticks, PLINT_VECTOR sub_ticks, PLINT_VECTOR n_values, PLFLT_MATRIX values)

## Detailed Description

Legend routines.

Definition in file pllegend.c.

## Macro Definition Documentation

## ◆ adopted_to_subpage_x

#define adopted_to_subpage_x | ( |  | nx | ) | ( ( xdmin_adopted ) + ( nx ) * ( ( xdmax_adopted ) - ( xdmin_adopted ) ) )

Convert from adopted X coordinate to normalized subpage X coordinate. The *_adopted variables are the normalized subpage limits of the adopted viewport which is either the external viewport (PL_POSITION_VIEWPORT bit set in the position parameter) or the subpage itself (PL_POSITION_SUBPAGE bit set in the position parameter, in which case this is an identity transform). See pllegend documentation for more details concerning the adopted coordinates.

Parameters

  nx | Adopted X coordinate.

Definition at line 344 of file pllegend.c.

## ◆ adopted_to_subpage_y

#define adopted_to_subpage_y | ( |  | ny | ) | ( ( ydmin_adopted ) + ( ny ) * ( ( ydmax_adopted ) - ( ydmin_adopted ) ) )

Convert from adopted Y coordinate to normalized subpage Y coordinate. The *_adopted variables are the normalized subpage limits of the adopted viewport which is either the external viewport (PL_POSITION_VIEWPORT bit set in the position parameter) or the subpage itself (PL_POSITION_SUBPAGE bit set in the position parameter, in which case this is an identity transform). See pllegend documentation for more details concerning the adopted coordinates.

Parameters

  ny | Adopted Y coordinate.

Definition at line 374 of file pllegend.c.

## ◆ max_opts

#define max_opts 25

## ◆ subpage_to_adopted_x

#define subpage_to_adopted_x | ( |  | nx | ) | ( ( nx - xdmin_adopted ) / ( ( xdmax_adopted ) - ( xdmin_adopted ) ) )

Convert from normalized subpage X coordinate to adopted X coordinate. The *_adopted variables are the normalized subpage limits of the adopted viewport which is either the external viewport (PL_POSITION_VIEWPORT bit set in the position parameter) or the subpage itself (PL_POSITION_SUBPAGE bit set in the position parameter, in which case this is an identity transform). See pllegend documentation for more details concerning the adopted coordinates.

Parameters

  nx | Normalized subpage X coordinate.

Definition at line 359 of file pllegend.c.

## ◆ subpage_to_adopted_y

#define subpage_to_adopted_y | ( |  | ny | ) | ( ( ny - ydmin_adopted ) / ( ( ydmax_adopted ) - ( ydmin_adopted ) ) )

Convert from normalized subpage Y coordinate to adopted Y coordinate. The *_adopted variables are the normalized subpage limits of the adopted viewport which is either the external viewport (PL_POSITION_VIEWPORT bit set in the position parameter) or the subpage itself (PL_POSITION_SUBPAGE bit set in the position parameter, in which case this is an identity transform). See pllegend documentation for more details concerning the adopted coordinates.

Parameters

  ny | Normalized subpage Y coordinate.

Definition at line 389 of file pllegend.c.

## Function Documentation

## ◆ c_plcolorbar()

void c_plcolorbar | ( | PLFLT * | p_colorbar_width,
|  | PLFLT * | p_colorbar_height,
|  | PLINT | opt,
|  | PLINT | position,
|  | PLFLT | x,
|  | PLFLT | y,
|  | PLFLT | x_length,
|  | PLFLT | y_length,
|  | PLINT | bg_color,
|  | PLINT | bb_color,
|  | PLINT | bb_style,
|  | PLFLT | low_cap_color,
|  | PLFLT | high_cap_color,
|  | PLINT | cont_color,
|  | PLFLT | cont_width,
|  | PLINT | n_labels,
|  | PLINT_VECTOR | label_opts,
|  | PLCHAR_MATRIX | labels,
|  | PLINT | n_axes,
|  | PLCHAR_MATRIX | axis_opts,
|  | PLFLT_VECTOR | ticks,
|  | PLINT_VECTOR | sub_ticks,
|  | PLINT_VECTOR | n_values,
|  | PLFLT_MATRIX | values
| ) |  |

Plot color bar for image, shade or gradient plots.

Parameters

  p_colorbar_width | Pointer to a location which contains (after the call) the labelled and decorated color bar width in adopted coordinates.
  p_colorbar_height | Pointer to a location which contains (after the call) the labelled and decorated color bar height in adopted coordinates.
  opt | This variable contains bits which control the overall color bar. The orientation (direction of the maximum value) of the color bar is specified with PL_COLORBAR_ORIENT_(RIGHT, TOP, LEFT, BOTTOM). If none of these bits are specified, the default orientation is toward the top if the colorbar is placed on the left or right of the viewport or toward the right if the colorbar is placed on the top or bottom of the viewport. If the PL_COLORBAR_BACKGROUND bit is set, plot a (semi-transparent) background for the color bar. If the PL_COLORBAR_BOUNDING_BOX bit is set, plot a bounding box for the color bar. The type of color bar must be specified with one of PL_COLORBAR_IMAGE, PL_COLORBAR_SHADE, or PL_COLORBAR_GRADIENT. If more than one of those bits is set only the first one in the above list is honored. The position of the (optional) label/title can be specified with PL_COLORBAR_LABEL_(RIGHT|TOP|LEFT|BOTTOM). If no label position bit is set then no label will be drawn. If more than one of this list of bits is specified, only the first one on the list is honored. End-caps for the color bar can added with PL_COLORBAR_CAP_LOW and PL_COLORBAR_CAP_HIGH. If a particular color bar cap option is not specified then no cap will be drawn for that end. As a special case for PL_COLORBAR_SHADE, the option PL_COLORBAR_SHADE_LABEL can be specified. If this option is provided then any tick marks and tick labels will be placed at the breaks between shaded segments. TODO: This should be expanded to support custom placement of tick marks and tick labels at custom value locations for any color bar type.
  position | This variable contains bits which control the overall position of the color bar and the definition of the adopted coordinates used for positions just like what is done for the position argument for pllegend. However, note that the defaults for the position bits (see below) are different than the pllegend 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 color bar 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 PL_POSITION_RIGHT. If neither of PL_POSITION_INSIDE or PL_POSITION_OUTSIDE is set, use PL_POSITION_OUTSIDE. If neither of PL_POSITION_VIEWPORT or PL_POSITION_SUBPAGE is set, use PL_POSITION_VIEWPORT.
  x | X offset of the color bar position in adopted coordinates from the specified standard position of the color bar. 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 for positive x is toward positive X.
  y | Y offset of the color bar position in adopted coordinates from the specified standard position of the color bar. 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 for positive y is toward positive Y.
  x_length | Length of the body of the color bar in the X direction in adopted coordinates.
  y_length | Length of the body of the color bar in the Y direction in adopted coordinates.
  bg_color | The cmap0 color of the background for the color bar (PL_COLORBAR_BACKGROUND).
  bb_color | The cmap0 color of the bounding-box line for the color bar (PL_COLORBAR_BOUNDING_BOX).
  bb_style | The pllsty style number for the bounding-box line for the color bar (PL_COLORBAR_BOUNDING_BOX).
  low_cap_color | The cmap1 color of the low-end color bar cap, if it is drawn (PL_COLORBAR_CAP_LOW).
  high_cap_color | The cmap1 color of the high-end color bar cap, if it is drawn (PL_COLORBAR_CAP_HIGH).
  cont_color | The cmap0 contour color for PL_COLORBAR_SHADE plots. This value is passed directly to plshades, so it will be interpreted according to the design of plshades.
  cont_width | Contour width for PL_COLORBAR_SHADE plots. This is passed directly to plshades, so it will be interpreted according to the design of plshades.
  n_labels | Number of labels to place around the color bar.
  label_opts | An array of n_labels opt values to help calculate the combined opt value for each of the labels. For each different label the combined opt value is the bitwise OR of the overall opt value and the relevant label_opts array element. The only bits that are relevant in a combined opt value for a label are PL_COLORBAR_ORIENT_(RIGHT|TOP|LEFT|BOTTOM) and PL_COLORBAR_LABEL_(RIGHT|TOP|LEFT|BOTTOM) (which are documented in the documentation of the overall opt value).
  labels | n_labels text labels for the color bar. No label is drawn if no label position is specified with one of the PL_COLORBAR_LABEL_(RIGHT|TOP|LEFT|BOTTOM) bits in the bitwise OR of the opt value with the relevant label_opts array element.
  n_axes | Number of axis definitions provided. This value must be greater than 0. It is typically 1 (numerical axis labels are provided for one of the long edges of the color bar), but it can be larger if multiple numerical axis labels for the long edges of the color bar are desired.
  axis_opts | An array of n_axes axis options (interpreted as for plbox) for the color bar's axis definitions.
  ticks | An array of n_axes values of the spacing of the major tick marks (interpreted as for plbox) for the color bar's axis definitions.
  sub_ticks | An array of n_axes values of the number of subticks (interpreted as for plbox) for the color bar's axis definitions.
  n_values | An array containing the number of elements in each of the n_axes rows of the two-dimensional values array.
  values | A two-dimensional array containing the numeric values for the data range represented by the color bar. For a row index of i_axis (where 0 < i_axis < n_axes), the number of elements in the row is specified by n_values[i_axis]. For PL_COLORBAR_IMAGE and PL_COLORBAR_GRADIENT the number of elements is 2, and the corresponding row elements of the values array are the minimum and maximum value represented by the colorbar. For PL_COLORBAR_SHADE, the number and values of the elements of a row of the values array is interpreted the same as the nlevel and clevel arguments of plshades.

Definition at line 1525 of file pllegend.c.

## ◆ c_pllegend()

void c_pllegend | ( | PLFLT * | p_legend_width,
|  | PLFLT * | p_legend_height,
|  | PLINT | opt,
|  | PLINT | position,
|  | PLFLT | x,
|  | PLFLT | y,
|  | PLFLT | plot_width,
|  | PLINT | bg_color,
|  | PLINT | bb_color,
|  | PLINT | bb_style,
|  | PLINT | nrow,
|  | PLINT | ncolumn,
|  | PLINT | nlegend,
|  | PLINT_VECTOR | opt_array,
|  | PLFLT | text_offset,
|  | PLFLT | text_scale,
|  | PLFLT | text_spacing,
|  | PLFLT | text_justification,
|  | PLINT_VECTOR | text_colors,
|  | PLCHAR_MATRIX | text,
|  | PLINT_VECTOR | box_colors,
|  | PLINT_VECTOR | box_patterns,
|  | PLFLT_VECTOR | box_scales,
|  | PLFLT_VECTOR | box_line_widths,
|  | PLINT_VECTOR | line_colors,
|  | PLINT_VECTOR | line_styles,
|  | PLFLT_VECTOR | line_widths,
|  | PLINT_VECTOR | symbol_colors,
|  | PLFLT_VECTOR | symbol_scales,
|  | PLINT_VECTOR | symbol_numbers,
|  | PLCHAR_MATRIX | symbols
| ) |  |

Plot legend using discretely annotated filled boxes, lines, and/or lines of symbols.

(N.B. the adopted coordinate system used for some of the parameters is defined in the documentation of the position parameter.)

Parameters

  p_legend_width | Pointer to a location which contains (after the call) the legend width in adopted coordinates. This quantity is calculated from the plot_width and text_offset arguments, the ncolumn argument (possibly modified inside the routine depending on the nlegend and nrow arguments), and the length (calculated internally) of the longest text string.
  p_legend_height | Pointer to a location which contains (after the call) the legend height in adopted coordinates. This quantity is calculated from the text_scale and text_spacing arguments and the nrow argument (possibly modified inside the routine depending on the nlegend and ncolumn arguments).
  opt | This variable contains bits which control 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 (semi-transparent) 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 > 1 and ncolumn > 1, then plot the resulting array of legend entries in row-major order. Otherwise, plot the legend entries in column-major order.
  position | This variable 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 4 centers of the 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 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.
  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 for positive x is toward positive X.
  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 for positive y is toward positive Y.
  plot_width | Horizontal width in adopted coordinates of the plot area (where colored boxes, lines, and/or symbols are drawn in the legend).
  bg_color | The cmap0 color of the background for the legend (PL_LEGEND_BACKGROUND).
  bb_color | The cmap0 color of the bounding-box line for the legend (PL_LEGEND_BOUNDING_BOX).
  bb_style | The pllsty style number for the bounding-box line for the legend (PL_LEGEND_BOUNDING_BOX).
  nrow | Number of rows in the matrix used to render the nlegend legend entries. For internal transformations of nrow, see further remarks under nlegend.
  ncolumn | Number of columns in the matrix used to render the nlegend legend entries. For internal transformations of ncolumn, see further remarks under nlegend.
  nlegend | Number of legend entries. The above nrow and ncolumn values are transformed internally to be consistent with nlegend. If either nrow or ncolumn is non-positive it is replaced by 1. If the resulting product of nrow and ncolumn is less than nlegend, the smaller of the two (or nrow, if nrow == ncolumn) is increased so the product is >= nlegend. Thus, for example, the common nrow = 0, ncolumn = 0 case is transformed internally to nrow = nlegend, ncolumn = 1; i.e., the usual case of a legend rendered as a single column.
  opt_array | Array 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 plotted area corresponding to a legend entry is specified with a colored box; a line; and/or a line of symbols.
  text_offset | Offset of the text area from the plot area in units of character width.
  text_scale | Character height scale for text annotations.
  text_spacing | Vertical spacing in units of the character height from one legend entry to the next.
  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.
  text_colors | Array of nlegend cmap0 text colors.
  text | Array of nlegend pointers to null-terminated text annotation strings. Like other PLplot strings specified by the user, the string must be UTF-8 (including its ascii subset) and may include any of the PLplot text escapes.
  box_colors | Array of nlegend cmap0 colors for the discrete colored boxes (PL_LEGEND_COLOR_BOX).
  box_patterns | Array of nlegend patterns (plpsty indices) for the discrete colored boxes (PL_LEGEND_COLOR_BOX).
  box_scales | Array of nlegend scales (units of fraction of character height) for the height of the discrete colored boxes (PL_LEGEND_COLOR_BOX).
  box_line_widths | Array of nlegend line widths for the patterns specified by box_patterns (PL_LEGEND_COLOR_BOX).
  line_colors | Array of nlegend cmap0 line colors (PL_LEGEND_LINE).
  line_styles | Array of nlegend line styles (pllsty indices) (PL_LEGEND_LINE).
  line_widths | Array of nlegend line widths (PL_LEGEND_LINE).
  symbol_colors | Array of nlegend cmap0 symbol colors (PL_LEGEND_SYMBOL).
  symbol_scales | Array of nlegend scale values for the symbol height (PL_LEGEND_SYMBOL).
  symbol_numbers | Array of nlegend numbers of symbols to be drawn across the width of the plotted area (PL_LEGEND_SYMBOL).
  symbols | Array of nlegend pointers to null-terminated strings which represent the glyph for the symbol to be plotted (PL_LEGEND_SYMBOL). Like other PLplot strings specified by the user, the string must be UTF-8 (including its ascii subset) and may include any of the PLplot text escapes.

Definition at line 531 of file pllegend.c.

## ◆ calculate_limits()

static void calculate_limits | ( | PLINT | position,
|  | PLFLT | x,
|  | PLFLT | y,
|  | PLFLT | xdmin_adopted,
|  | PLFLT | xdmax_adopted,
|  | PLFLT | ydmin_adopted,
|  | PLFLT | ydmax_adopted,
|  | PLFLT | prior_bb_height,
|  | PLFLT * | p_colorbar_width_bb,
|  | PLFLT * | p_colorbar_height_bb,
|  | PLFLT * | p_colorbar_width_ac,
|  | PLFLT * | p_colorbar_height_ac,
|  | PLFLT * | p_plot_x_subpage_bb,
|  | PLFLT * | p_plot_y_subpage_bb,
|  | PLFLT * | p_dx_subpage,
|  | PLFLT * | p_dy_subpage
| ) |  |
| static

Calculate important positional limits for color bar as a function of the current bounding box limits and prior bounding-box height. plvpor(0, prior_bb_width, 0, prior_bb_height) is called before each bounding-box calculation and this calculate_limits call, where prior_bb_width and prior_bb_height are the width and height of the prior bounding box in subpage coordinates. Thus, an arbitrary but convenient offset is given to old and new bounding box limits because the actual offset is not known until calculate_limits is finished.

Definition at line 1348 of file pllegend.c.

## ◆ draw_box()

static void draw_box | ( | PLBOOL | if_bb,
|  | PLINT | opt,
|  | PLCHAR_VECTOR | axis_opts,
|  | PLBOOL | if_edge,
|  | PLFLT | ticks,
|  | PLINT | sub_ticks,
|  | PLINT | n_values,
|  | PLFLT_VECTOR | values
| ) |  |
| static

Draw box (when if_bb FALSE) around color bar with possible tick marks, numerical labels of those tick marks, and exponent decorations of that box or else (when if_bb TRUE) calculate bounding box of that decorated box.

Parameters

  if_bb | If if_bb is TRUE evaluate bounding box of decorated box. If if_bb is FALSE draw the decorated box.
  opt | Can contain the same control bits as the opt argument for plcolorbar. However, the only bits that are relevant here are PL_COLORBAR_SHADE, PL_COLORBAR_SHADE_LABEL, and PL_COLORBAR_ORIENT_(RIGHT|TOP|LEFT|BOTTOM). For full documentation of these bits, see the documentation of opt for plcolorbar.
  axis_opts | Axis options for the color bar's major axis, as for plcolorbar.
  if_edge | If if_edge is TRUE (FALSE) do (do not) draw the edge of the colorbox.
  ticks | As for plcolorbar.
  sub_ticks | As for plcolorbar.
  n_values | As for plcolorbar.
  values | As for plcolorbar.

Definition at line 1062 of file pllegend.c.

## ◆ draw_cap()

static void draw_cap | ( | PLBOOL | if_edge,
|  | PLINT | orientation,
|  | PLFLT | xmin,
|  | PLFLT | xmax,
|  | PLFLT | ymin,
|  | PLFLT | ymax,
|  | PLFLT | color
| ) |  |
| static

Draw triangular end-caps for color bars.

Parameters

  if_edge | If if_edge is true/false, draw an edge/no edge around the triangle.
  orientation | This variable defines the orientation of the triangle. The triangle points to the right, up, left, or down if orientation contains PL_COLORBAR_ORIENT_RIGHT, PL_COLORBAR_ORIENT_TOP, PL_COLORBAR_ORIENT_LEFT, or PL_COLORBAR_ORIENT_BOTTOM bits.
  xmin | Minimum world X coordinate of rectangle inscribing the triangle.
  xmax | Maximum world X coordinate of rectangle inscribing the triangle.
  ymin | Minimum world Y coordinate of rectangle inscribing the triangle.
  ymax | Maximum world Y coordinate of rectangle inscribing the triangle.
  color | The cmap1 color used to fill the end cap.

Definition at line 973 of file pllegend.c.

## ◆ draw_label()

static void draw_label | ( | PLBOOL | if_bb,
|  | PLINT | opt,
|  | PLCHAR_VECTOR | label
| ) |  |
| static

Draw label (when if_bb FALSE) with appropriate position relative to the "inner" bounding-box of the decorated box around the color bar or else (when if_bb TRUE) calculate combined bounding box of that label

- decorated box.

Parameters

  if_bb | If if_bb is TRUE evaluate bounding box of combined decorated box + label. If if_bb is FALSE draw the label.
  opt | Can contain the same control bits as the opt argument for plcolorbar. However, the only bits that are relevant here are PL_COLORBAR_ORIENT_(RIGHT|TOP|LEFT|BOTTOM), and PL_COLORBAR_LABEL_(RIGHT|TOP|LEFT|BOTTOM). For full documentation of these bits, see the documentation of opt for plcolorbar.
  label | Text label for the color bar. No label is drawn if no label position is specified with one of the PL_COLORBAR_LABEL_(RIGHT|TOP|LEFT|BOTTOM) bits in opt.

Definition at line 1138 of file pllegend.c.

## ◆ get_character_or_symbol_height()

static PLFLT get_character_or_symbol_height | ( | PLBOOL | ifcharacter | ) |
| static

Obtain character or symbol height in (y) in normalized subpage coordinates.

Parameters

  ifcharacter | TRUE obtain character height, FALSE obtain symbol height.

Returns
  character or symbol height.

Definition at line 312 of file pllegend.c.

## ◆ get_subpage_per_mm()

static void get_subpage_per_mm | ( | PLFLT * | x_subpage_per_mm,
|  | PLFLT * | y_subpage_per_mm
| ) |  |
| static

Obtain ratio of normalized subpage to mm coordinates in both x and y.

Parameters

  x_subpage_per_mm | Pointer to a location that contains (after the call) the x ratio.
  y_subpage_per_mm | Pointer to a location that contains (after the call) the y ratio.

Definition at line 295 of file pllegend.c.

## ◆ legend_position()

static void legend_position | ( | PLINT | position,
|  | PLFLT | legend_width,
|  | PLFLT | legend_height,
|  | PLFLT * | x_legend_position,
|  | PLFLT * | y_legend_position,
|  | PLFLT * | xsign,
|  | PLFLT * | ysign
| ) |  |
| static

Calculate parameters that help determine the position of the top left of the legend in adopted coordinates. See pllegend documentation for definition of adopted coordinates.

Parameters

  position | Control variable containing valid combinations of the following control bits that specify the 16 standard positions of the legend: PL_POSITION_LEFT, PL_POSITION_RIGHT, PL_POSITION_TOP, PL_POSITION_BOTTOM, PL_POSITION_INSIDE, and PL_POSITION_OUTSIDE.
  legend_width | Total legend width in adopted coordinates.
  legend_height | Total legend height in adopted coordinates.
  x_legend_position | Pointer to a location that contains (after the call) the X value in adopted coordinates of one of the 16 standard legend positions specified by position.
  y_legend_position | Pointer to a location that contains (after the call) the Y equivalent of x_legend_position.
  xsign | Pointer to a location that contains (after the call) the sign of the X offset relative to the standard legend position specified by position.
  ysign | Pointer to a location that contains (after the call) the Y equivalent to xsign.

Definition at line 87 of file pllegend.c.

## ◆ plgvpsp()

static void plgvpsp | ( | PLFLT * | p_xmin,
|  | PLFLT * | p_xmax,
|  | PLFLT * | p_ymin,
|  | PLFLT * | p_ymax
| ) |  |
| static

Determine arguments of the last call to plvpor. This gives a different result than plgvpd if there is more than one subpage per page.

Parameters

  p_xmin | Pointer to a location that contains (after the call) the normalized subpage coordinate of the left-hand edge of the viewport.
  p_xmax | Pointer to a location that contains (after the call) the normalized subpage coordinate of the right-hand edge of the viewport.
  p_ymin | Pointer to a location that contains (after the call) the normalized subpage coordinate of the bottom edge of the viewport.
  p_ymax | Pointer to a location that contains (after the call) the normalized subpage coordinate of the top edge of the viewport.

Definition at line 46 of file pllegend.c.

## ◆ remove_characters()

static void remove_characters | ( | char * | string,
|  | PLCHAR_VECTOR | characters
| ) |  |
| static

Remove specified ascii characters from null-terminated string.

Parameters

  string | Null-terminated string where specified characters (if present) are removed.
  characters | Null-terminated string consisting of ascii characters to be removed from string.

Definition at line 933 of file pllegend.c.