PLplot  5.10.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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, const PLINT *opt_array, PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, PLFLT text_justification, const PLINT *text_colors, const char *const *text, const PLINT *box_colors, const PLINT *box_patterns, const PLFLT *box_scales, const PLFLT *box_line_widths, const PLINT *line_colors, const PLINT *line_styles, const PLFLT *line_widths, const PLINT *symbol_colors, const PLFLT *symbol_scales, const PLINT *symbol_numbers, const char *const *symbols)
static void remove_characters (char *string, const char *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, const char *axis_opts, PLBOOL if_edge, PLFLT ticks, PLINT sub_ticks, PLINT n_values, const PLFLT *values)
static void draw_label (PLBOOL if_bb, PLINT opt, const char *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, const PLINT *label_opts, const char *const *labels, PLINT n_axes, const char *const *axis_opts, const PLFLT *ticks, const PLINT *sub_ticks, const PLINT *n_values, const PLFLT *const *values)

Detailed Description

Legend routines.

Definition in file pllegend.c.

Macro Definition Documentation

#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
nxAdopted X coordinate.

Definition at line 344 of file pllegend.c.

#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
nyAdopted Y coordinate.

Definition at line 374 of file pllegend.c.

#define max_opts   25
#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
nxNormalized subpage X coordinate.

Definition at line 359 of file pllegend.c.

#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
nyNormalized subpage Y coordinate.

Definition at line 389 of file pllegend.c.

Function Documentation

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,
const PLINT label_opts,
const char *const *  labels,
PLINT  n_axes,
const char *const *  axis_opts,
const PLFLT ticks,
const PLINT sub_ticks,
const PLINT n_values,
const PLFLT *const *  values 
)

Plot color bar for image, shade or gradient plots.

Parameters
p_colorbar_widthPointer to a location which contains (after the call) the labelled and decorated color bar width in adopted coordinates.
p_colorbar_heightPointer to a location which contains (after the call) the labelled and decorated color bar height in adopted coordinates.
optThis 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.
positionThis 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.
xX 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.
yY 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_lengthLength of the body of the color bar in the X direction in adopted coordinates.
y_lengthLength of the body of the color bar in the Y direction in adopted coordinates.
bg_colorThe cmap0 color of the background for the color bar (PL_COLORBAR_BACKGROUND).
bb_colorThe cmap0 color of the bounding-box line for the color bar (PL_COLORBAR_BOUNDING_BOX).
bb_styleThe pllsty style number for the bounding-box line for the color bar (PL_COLORBAR_BOUNDING_BOX).
low_cap_colorThe cmap1 color of the low-end color bar cap, if it is drawn (PL_COLORBAR_CAP_LOW).
high_cap_colorThe cmap1 color of the high-end color bar cap, if it is drawn (PL_COLORBAR_CAP_HIGH).
cont_colorThe 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_widthContour width for PL_COLORBAR_SHADE plots. This is passed directly to plshades, so it will be interpreted according to the design of plshades.
n_labelsNumber of labels to place around the color bar.
label_optsAn 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).
labelsn_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_axesNumber 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_optsAn array of n_axes axis options (interpreted as for plbox) for the color bar's axis definitions.
ticksAn 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_ticksAn array of n_axes values of the number of subticks (interpreted as for plbox) for the color bar's axis definitions.
n_valuesAn array containing the number of elements in each of the n_axes rows of the two-dimensional values array.
valuesA 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.

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,
const PLINT opt_array,
PLFLT  text_offset,
PLFLT  text_scale,
PLFLT  text_spacing,
PLFLT  text_justification,
const PLINT text_colors,
const char *const *  text,
const PLINT box_colors,
const PLINT box_patterns,
const PLFLT box_scales,
const PLFLT box_line_widths,
const PLINT line_colors,
const PLINT line_styles,
const PLFLT line_widths,
const PLINT symbol_colors,
const PLFLT symbol_scales,
const PLINT symbol_numbers,
const char *const *  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_widthPointer 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_heightPointer 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).
optThis 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.
positionThis 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.
xX 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.
yY 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_widthHorizontal width in adopted coordinates of the plot area (where colored boxes, lines, and/or symbols are drawn in the legend).
bg_colorThe cmap0 color of the background for the legend (PL_LEGEND_BACKGROUND).
bb_colorThe cmap0 color of the bounding-box line for the legend (PL_LEGEND_BOUNDING_BOX).
bb_styleThe pllsty style number for the bounding-box line for the legend (PL_LEGEND_BOUNDING_BOX).
nrowNumber of rows in the matrix used to render the nlegend legend entries. For internal transformations of nrow, see further remarks under nlegend.
ncolumnNumber of columns in the matrix used to render the nlegend legend entries. For internal transformations of ncolumn, see further remarks under nlegend.
nlegendNumber 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_arrayArray 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_offsetOffset of the text area from the plot area in units of character width.
text_scaleCharacter height scale for text annotations.
text_spacingVertical spacing in units of the character height from one legend entry to the next.
text_justificationJustification 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_colorsArray of nlegend cmap0 text colors.
textArray 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_colorsArray of nlegend cmap0 colors for the discrete colored boxes (PL_LEGEND_COLOR_BOX).
box_patternsArray of nlegend patterns (plpsty indices) for the discrete colored boxes (PL_LEGEND_COLOR_BOX).
box_scalesArray of nlegend scales (units of fraction of character height) for the height of the discrete colored boxes (PL_LEGEND_COLOR_BOX).
box_line_widthsArray of nlegend line widths for the patterns specified by box_patterns (PL_LEGEND_COLOR_BOX).
line_colorsArray of nlegend cmap0 line colors (PL_LEGEND_LINE).
line_stylesArray of nlegend line styles (pllsty indices) (PL_LEGEND_LINE).
line_widthsArray of nlegend line widths (PL_LEGEND_LINE).
symbol_colorsArray of nlegend cmap0 symbol colors (PL_LEGEND_SYMBOL).
symbol_scalesArray of nlegend scale values for the symbol height (PL_LEGEND_SYMBOL).
symbol_numbersArray of nlegend numbers of symbols to be drawn across the width of the plotted area (PL_LEGEND_SYMBOL).
symbolsArray 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.

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.

static void draw_box ( PLBOOL  if_bb,
PLINT  opt,
const char *  axis_opts,
PLBOOL  if_edge,
PLFLT  ticks,
PLINT  sub_ticks,
PLINT  n_values,
const PLFLT 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_bbIf if_bb is TRUE evaluate bounding box of decorated box. If if_bb is FALSE draw the decorated box.
optCan 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_optsAxis options for the color bar's major axis, as for plcolorbar.
if_edgeIf if_edge is TRUE (FALSE) do (do not) draw the edge of the colorbox.
ticksAs for plcolorbar.
sub_ticksAs for plcolorbar.
n_valuesAs for plcolorbar.
valuesAs for plcolorbar.

Definition at line 1062 of file pllegend.c.

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_edgeIf if_edge is true/false, draw an edge/no edge around the triangle.
orientationThis 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.
xminMinimum world X coordinate of rectangle inscribing the triangle.
xmaxMaximum world X coordinate of rectangle inscribing the triangle.
yminMinimum world Y coordinate of rectangle inscribing the triangle.
ymaxMaximum world Y coordinate of rectangle inscribing the triangle.
colorThe cmap1 color used to fill the end cap.

Definition at line 973 of file pllegend.c.

static void draw_label ( PLBOOL  if_bb,
PLINT  opt,
const char *  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_bbIf if_bb is TRUE evaluate bounding box of combined decorated box + label. If if_bb is FALSE draw the label.
optCan 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.
labelText 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.

static PLFLT get_character_or_symbol_height ( PLBOOL  ifcharacter)
static

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

Parameters
ifcharacterTRUE obtain character height, FALSE obtain symbol height.
Returns
character or symbol height.

Definition at line 312 of file pllegend.c.

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_mmPointer to a location that contains (after the call) the x ratio.
y_subpage_per_mmPointer to a location that contains (after the call) the y ratio.

Definition at line 295 of file pllegend.c.

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
positionControl 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_widthTotal legend width in adopted coordinates.
legend_heightTotal legend height in adopted coordinates.
x_legend_positionPointer 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_positionPointer to a location that contains (after the call) the Y equivalent of x_legend_position.
xsignPointer to a location that contains (after the call) the sign of the X offset relative to the standard legend position specified by position.
ysignPointer to a location that contains (after the call) the Y equivalent to xsign.

Definition at line 87 of file pllegend.c.

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_xminPointer to a location that contains (after the call) the normalized subpage coordinate of the left-hand edge of the viewport.
p_xmaxPointer to a location that contains (after the call) the normalized subpage coordinate of the right-hand edge of the viewport.
p_yminPointer to a location that contains (after the call) the normalized subpage coordinate of the bottom edge of the viewport.
p_ymaxPointer 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.

static void remove_characters ( char *  string,
const char *  characters 
)
static

Remove specified ascii characters from null-terminated string.

Parameters
stringNull-terminated string where specified characters (if present) are removed.
charactersNull-terminated string consisting of ascii characters to be removed from string.

Definition at line 933 of file pllegend.c.