PLLEGEND(3plplot)
π NAME π
pllegend β plot legend using discretely annotated filled boxes, lines, and/or lines of symbols. ngl, this is PLLEGEND(3plplot) from the PLplot API, and we're gonna walk through it together, bestie. π«Ά
β¨ SYNOPSIS β¨
okay so the full call is literally this β keep it character for character, no cap:
pllegend(p_legend_width, p_legend_height, opt, position, x, y,
plot_width, bg_color, bb_color, bb_style, nrow, ncolumn, nlegend,
opt_array, text_offset, text_scale, text_spacing, test_justification,
text_colors, text, box_colors, box_patterns, box_scales,
box_line_widths, line_colors, line_styles, line_widths, symbol_colors,
symbol_scales, symbol_numbers, symbols)
and the redacted form is this exact list, again copied as written (yes, including the spelling test_justification β do not autocorrect it, periodt):
pllegend(p_legend_width, p_legend_height, opt, position,
x, y, plot_width, bg_color, bb_color, bb_style, nrow, ncolumn,
opt_array, text_offset, text_scale, text_spacing, test_justification,
text_colors, text, box_colors, box_patterns, box_scales,
box_line_widths, line_colors, line_styles, line_widths, symbol_colors,
symbol_scales, symbol_numbers, symbols)
πΈ DESCRIPTION πΈ
This routine is lowkey your main character for making a discrete plot legend, with a plotted filled box, a line, and/or a line of symbols for each annotated legend entry. It's giving choose-your-own-legend era. (For similar functionality that creates continuous color bars, see plcolorbar(3plplot).) The arguments of pllegend control the location and size of the legend, plus the location and characteristics of the elements within that legend β and most of those elements are optional. 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. π
You'll spot this function in examples 4, 26, and 33. π
π ARGUMENTS π
okay bestie, here's the full argument roster β every one, no skips, no vibe-only summary. β¨
p_legend_widthβ (PLFLT_NC_SCALAR(3plplot), output) Returned value of the legend width in adopted coordinates. This quantity is calculated fromplot_width,text_offset,ncolumn(possibly modified inside the routine depending onnlegendandnrow), and the length (calculated internally) of the longest text string.p_legend_heightβ (PLFLT_NC_SCALAR(3plplot), output) Returned value of the legend height in adopted coordinates. This quantity is calculated fromtext_scale,text_spacing, andnrow(possibly modified inside the routine depending onnlegendandnrow).optβ (PLINT(3plplot), input) bits controlling the overall legend. Here's the vibe check:- If the
PL_LEGEND_TEXT_LEFTbit 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_BACKGROUNDbit is set, plot a (semitransparent) background for the legend. - If the
PL_LEGEND_BOUNDING_BOXbit is set, plot a bounding box for the legend. - If the
PL_LEGEND_ROW_MAJORbit is set and (both of the possibly internally transformed)nrow> 1 andncolumn> 1, then plot the resulting array of legend entries in row-major order. Otherwise, plot the legend entries in column-major order.
- If the
positionβ (PLINT(3plplot), input) bits that control the overall position of the legend and the definition of the adopted coordinates used for positions, just like what is done for thepositionargument forplcolorbar(3plplot). However, note that the defaults for the position bits (see below) are different than theplcolorbar(3plplot)case.- The combination of the
PL_POSITION_LEFT,PL_POSITION_RIGHT,PL_POSITION_TOP,PL_POSITION_BOTTOM,PL_POSITION_INSIDE, andPL_POSITION_OUTSIDEbits 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. - Corner positions are specified by the appropriate combination of two of
PL_POSITION_LEFT,PL_POSITION_RIGHT,PL_POSITION_TOP, andPL_POSITION_BOTTOM, 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_VIEWPORTbit is set, or normalized subpage coordinates if thePL_POSITION_SUBPAGEbit is set. - Default position bits: if none of
PL_POSITION_LEFT,PL_POSITION_RIGHT,PL_POSITION_TOP, orPL_POSITION_BOTTOMare set, then use the combination ofPL_POSITION_RIGHTandPL_POSITION_TOP. If neitherPL_POSITION_INSIDEnorPL_POSITION_OUTSIDEis set, usePL_POSITION_INSIDE. If neitherPL_POSITION_VIEWPORTnorPL_POSITION_SUBPAGEis set, usePL_POSITION_VIEWPORT.
- The combination of the
xβ (PLFLT(3plplot), input) X offset of the legend position in adopted coordinates from the specified standard position of the legend. For positivex, the direction of motion away from the standard position is inward/outward from the standard corner positions or standard left or right positions if thePL_POSITION_INSIDE/PL_POSITION_OUTSIDEbit is set inposition. For the standard top or bottom positions, the direction of motion is toward positive X.yβ (PLFLT(3plplot), input) Y offset of the legend position in adopted coordinates from the specified standard position of the legend. For positivey, the direction of motion away from the standard position is inward/outward from the standard corner positions or standard top or bottom positions if thePL_POSITION_INSIDE/PL_POSITION_OUTSIDEbit is set inposition. For the standard left or right positions, the direction of motion is toward positive Y.plot_widthβ (PLFLT(3plplot), input) Horizontal width in adopted coordinates of the plot area (where the colored boxes, lines, and/or lines of symbols are drawn) of the legend.bg_colorβ (PLINT(3plplot), input) The cmap0 color of the background for the legend (PL_LEGEND_BACKGROUND).bb_colorβ (PLINT(3plplot), input) The cmap0 color of the bounding-box line for the legend (PL_LEGEND_BOUNDING_BOX).bb_styleβ (PLINT(3plplot), input) Thepllstystyle number for the bounding-box line for the legend (PL_LEGEND_BACKGROUND).nrowβ (PLINT(3plplot), input) The number of rows in the matrix used to render thenlegendlegend entries. For internal transformations ofnrow, see further remarks undernlegend.ncolumnβ (PLINT(3plplot), input) The number of columns in the matrix used to render thenlegendlegend entries. For internal transformations ofncolumn, see further remarks undernlegend.nlegendβ (PLINT(3plplot), input) Number of legend entries. The abovenrowandncolumnvalues are transformed internally to be consistent withnlegend. If eithernroworncolumnis non-positive it is replaced by 1. If the resulting product ofnrowandncolumnis less thannlegend, the smaller of the two (ornrow, ifnrow == ncolumn) is increased so the product is >=nlegend. Thus, for example, the commonnrow = 0,ncolumn = 0case is transformed internally tonrow = nlegend,ncolumn = 1; i.e., the usual case of a legend rendered as a single column.opt_arrayβ (PLINT_VECTOR(3plplot), input) A vector ofnlegendvalues of options to control each individual plotted area corresponding to a legend entry. If thePL_LEGEND_NONEbit is set, then nothing is plotted in the plotted area. If thePL_LEGEND_COLOR_BOX,PL_LEGEND_LINE, and/orPL_LEGEND_SYMBOLbits are set, the area corresponding to a legend entry is plotted with a colored box; a line; and/or a line of symbols.text_offsetβ (PLFLT(3plplot), input) Offset of the text area from the plot area in units of character width.text_scaleβ (PLFLT(3plplot), input) Character height scale for text annotations.text_spacingβ (PLFLT(3plplot), input) Vertical spacing in units of the character height from one legend entry to the next.text_justificationβ (PLFLT(3plplot), input) Justification parameter used for text justification. The most common values oftext_justificationare0.,0.5, or1.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β (PLINT_VECTOR(3plplot), input) A vector containingnlegendcmap0 text colors.textβ (PLCHAR_MATRIX(3plplot), input) A vector ofnlegendUTF-8 character strings containing the legend annotations.box_colorsβ (PLINT_VECTOR(3plplot), input) A vector containingnlegendcmap0 colors for the discrete colored boxes (PL_LEGEND_COLOR_BOX).box_patternsβ (PLINT_VECTOR(3plplot), input) A vector containingnlegendpatterns (plpstyindices) for the discrete colored boxes (PL_LEGEND_COLOR_BOX).box_scalesβ (PLFLT_VECTOR(3plplot), input) A vector containingnlegendscales (units of fraction of character height) for the height of the discrete colored boxes (PL_LEGEND_COLOR_BOX).box_line_widthsβ (PLFLT_VECTOR(3plplot), input) A vector containingnlegendline widths for the patterns specified bybox_patterns(PL_LEGEND_COLOR_BOX).line_colorsβ (PLINT_VECTOR(3plplot), input) A vector containingnlegendcmap0 line colors (PL_LEGEND_LINE).line_stylesβ (PLINT_VECTOR(3plplot), input) A vector containingnlegendline styles (plstyindices) (PL_LEGEND_LINE).line_widthsβ (PLFLT_VECTOR(3plplot), input) A vector containingnlegendline widths (PL_LEGEND_LINE).symbol_colorsβ (PLINT_VECTOR(3plplot), input) A vector containingnlegendcmap0 symbol colors (PL_LEGEND_SYMBOL).symbol_scalesβ (PLFLT_VECTOR(3plplot), input) A vector containingnlegendscale values for the symbol height (PL_LEGEND_SYMBOL).symbol_numbersβ (PLINT_VECTOR(3plplot), input) A vector containingnlegendnumbers of symbols to be drawn across the width of the plotted area (PL_LEGEND_SYMBOL).symbolsβ (PLCHAR_MATRIX(3plplot), input) A vector ofnlegendUTF-8 character strings containing the legend symbols. (PL_LEGEND_SYMBOL).
π AUTHORS π
Many developers (who are credited at http://plplot.sourceforge.net/credits.php) have contributed to PLplot over its long history. Iconic collaboration energy, honestly β they ate. π
π¦ SEE ALSO π¦
PLplot documentation at http://plplot.sourceforge.net/documentation.php. Go read, bestie. π
Alright bestie, that's the whole page πPLLEGEND(3plplot)from thePLplot API, footer dateAugust, 2026β source/version and date, all wrapped up with a bow πβ¨
π¦ where this page comes from
- ubuntu stonking: plplot-doc 5.15.0+dfsg3-4 Β· LGPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms