theme

class theme(exponentFormat: Any? = null, line: Any? = null, rect: Any? = null, text: Any? = null, title: Any? = null, axis: Any? = null, axisOntop: Boolean? = null, axisOntopX: Boolean? = null, axisOntopY: Boolean? = null, axisTitle: Any? = null, axisTitleX: Any? = null, axisTitleY: Any? = null, axisText: Any? = null, axisTextX: Any? = null, axisTextY: Any? = null, axisTicks: Any? = null, axisTicksX: Any? = null, axisTicksY: Any? = null, axisTicksLength: Number? = null, axisTicksLengthX: Number? = null, axisTicksLengthY: Number? = null, axisTextSpacing: Number? = null, axisTextSpacingX: Number? = null, axisTextSpacingY: Number? = null, axisLine: Any? = null, axisLineX: Any? = null, axisLineY: Any? = null, legendBackground: Any? = null, legendText: Any? = null, legendTitle: Any? = null, legendMargin: Any? = null, legendSpacing: Number? = null, legendSpacingX: Number? = null, legendSpacingY: Number? = null, legendKey: Any? = null, legendKeySize: Number? = null, legendKeyWidth: Number? = null, legendKeyHeight: Number? = null, legendKeySpacing: Number? = null, legendKeySpacingX: Number? = null, legendKeySpacingY: Number? = null, legendBoxSpacing: Number? = null, legendTicks: Any? = null, legendTicksLength: Number? = null, panelBackground: Any? = null, panelBorder: Any? = null, panelBorderOntop: Boolean? = null, panelGrid: Any? = null, panelGridMajor: Any? = null, panelGridMinor: Any? = null, panelGridMajorX: Any? = null, panelGridMinorX: Any? = null, panelGridMajorY: Any? = null, panelGridMinorY: Any? = null, panelGridOntop: Boolean? = null, panelGridOntopX: Boolean? = null, panelGridOntopY: Boolean? = null, panelInset: Any? = null, plotBackground: Any? = null, plotTitle: Any? = null, plotSubtitle: Any? = null, plotCaption: Any? = null, plotMessage: Any? = null, plotMargin: Any? = null, plotInset: Any? = null, plotTitlePosition: Any? = null, plotCaptionPosition: Any? = null, stripBackground: Any? = null, stripBackgroundX: Any? = null, stripBackgroundY: Any? = null, stripText: Any? = null, stripTextX: Any? = null, stripTextY: Any? = null, axisTooltip: Any? = null, axisTooltipX: Any? = null, axisTooltipY: Any? = null, axisTooltipText: Any? = null, axisTooltipTextX: Any? = null, axisTooltipTextY: Any? = null, tooltip: Any? = null, tooltipText: Any? = null, tooltipTitleText: Any? = null, labelText: Any? = null, geom: Any? = null) : OptionsMap

Use theme() to modify individual components of a theme, allowing you to control the appearance of all non-data components of the plot. See also the Plot Layout Diagrams section.

Most parameters in theme() control styling of text, line, and rectangular elements.

All styling parameters accept:

  • String "blank" or result of elementBlank() to hide the element

  • Additionally, based on element type:

  • Text elements: result of elementText()

  • Rectangular elements: result of elementRect()

  • Line elements: result of elementLine()

Parameter naming follows a pattern:

  • Parameters controlling text elements end with "Text" or "Title" (e.g., axisText, plotTitle)

  • Parameters controlling rectangular elements end with "Background" or "Rect" (e.g., panelBackground)

  • Parameters controlling line elements end with "Line", "Grid", "Ticks", or "Border" (e.g., axisLine, panelGrid)

Settings passed via more specific parameters override settings passed via less specific parameters. For example, parameter axisLineX is more specific than parameter axisLine.

Examples

Parameters

exponentFormat

default="e" ("e", "pow", "pow_full"). Controls the appearance of numbers formatted with "e" or "g" types.

Value is either a string - style, or a list: listOf(style, lower_exp_bound, upper_exp_bound) where style can be:

  • "e" : e-notation (e.g., 1e+6)

  • "pow" : superscript powers of 10 in shortened form (e.g., 10^6)

  • "pow_full" : superscript powers of 10 with coefficient (e.g., 1×10^6)

For "g" type formatting, scientific notation is applied when the number's exponent is less than or equal to the lower_exp_bound (-7 by default) or greater than or equal to the upper_exp_bound (6 by default, but can be affected by precision in format specifier).

See: Formatting

line

Style settings for all line elements.

rect

Style settings for all rectangular elements.

text

Style settings for all text elements.

title

Style settings for all title elements: plot, axes, legends.

axis

Style settings for all axis elements: lines, ticks, texts, titles.

axisOntop

Option to place axis (lines, tick-marks and labels) over the data layers.

axisOntopX

Option to place X-axis (lines, tick-marks and labels) over the data layers.

axisOntopY

Option to place Y-axis (lines, tick-marks and labels) over the data layers.

axisTitle

Style settings for axis titles.

axisTitleX

Style settings for axis titles.

axisTitleY

Style settings for axis titles.

axisText

Style settings for tick labels along axes.

axisTextX

Style settings for tick labels along axes.

axisTextY

Style settings for tick labels along axes.

axisTicks

Style settings for tick marks along axes.

axisTicksX

Style settings for tick marks along axes.

axisTicksY

Style settings for tick marks along axes.

axisTicksLength

Length of tick marks.

axisTicksLengthX

Length of tick marks.

axisTicksLengthY

Length of tick marks.

axisTextSpacing

Spacing between the axis label text and its tick mark.

axisTextSpacingX

Spacing between the axis label text and its tick mark.

axisTextSpacingY

Spacing between the axis label text and its tick mark.

axisLine

Style settings for lines along axes.

axisLineX

Style settings for lines along axes.

axisLineY

Style settings for lines along axes.

legendBackground

Style settings for background of legend.

legendText

Style settings for legend item labels.

legendTitle

Style settings for legend title.

legendMargin

Margin around each legend. The margin may be specified using a number or a list of numbers:

  • a single number or a list of one number - the same margin is applied to all four sides;

  • a list of two numbers - the first margin applies to the top and bottom, the second - to the left and right;

  • a list of three numbers - the first margin applies to the top, the second - to the right and left, the third - to the bottom;

  • a list of four numbers - the margins are applied to the top, right, bottom and left in that order. It is acceptable to use null for any side; in this case, the default side value for the legend margin side will be used.

legendSpacing

Spacing between legends.

legendSpacingX

Spacing between legends in the horizontal direction.

legendSpacingY

Spacing between legends in the vertical direction.

legendKey

Style settings for legend key background.

legendKeySize

Size of legend keys.

legendKeyWidth

Key background width.

legendKeyHeight

Key background height.

legendKeySpacing

Spacing between legend keys

legendKeySpacingX

Spacing between legend keys in the horizontal direction.

legendKeySpacingY

Spacing between legend keys in the vertical direction.

legendBoxSpacing

Spacing between plotting area and legend box.

legendTicks

Style settings for tick marks in colorbars.

legendTicksLength

Length of tick marks in colorbar.

panelBackground

Style settings for background of plotting area.

panelBorder

Style settings for border around plotting area.

panelBorderOntop

Option to place border around plotting area over the data layers.

panelGrid

Style settings for grid lines.

panelGridMajor

Style settings for major grid lines.

panelGridMinor

Style settings for minor grid lines.

panelGridMajorX

Style settings for major grid lines.

panelGridMinorX

Style settings for minor grid lines.

panelGridMajorY

Style settings for major grid lines.

panelGridMinorY

Style settings for minor grid lines.

panelGridOntop

Option to place major grid lines and minor grid lines over the data layers.

panelGridOntopX

Option to place X-axis major grid lines and minor grid lines over the data layers.

panelGridOntopY

Option to place Y-axis major grid lines and minor grid lines over the data layers.

panelInset

Inset for a panel. The inset behaves like a padding for coordPolar(transformBkgr = false) otherwise it behaves like a margin around the panel. The inset may be specified using a number or a list of numbers:

  • a single number or a list of one number - the same inset is applied to all four sides;

  • a list of two numbers - the first inset applies to the top and bottom, the second - to the left and right;

  • a list of three numbers - the first margin applies to the top, the second - to the right and left, the third - to the bottom;

  • a list of four numbers - the insets are applied to the top, right, bottom and left in that order. It is acceptable to use null for any side; in this case, the default value for the panel inset side will be used.

plotBackground

Style settings for overall plot background.

plotTitle

Style settings for plot title.

plotSubtitle

Style settings for plot subtitle.

plotCaption

Style settings for plot caption.

plotMessage

Style settings for plot message (e.g. sampling messages). Set an elementBlank() to show nothing. Set an elementText() to show sampling messages (elementText() options do not affect the message text).

plotMargin

Margin around entire plot. The margin may be specified using a number or a list of numbers:

  • a single number or a list of one number - the same margin is applied to all four sides;

  • a list of two numbers - the first margin applies to the top and bottom, the second - to the left and right;

  • a list of three numbers - the first margin applies to the top, the second - to the right and left, the third - to the bottom;

  • a list of four numbers - the margins are applied to the top, right, bottom and left in that order. It is acceptable to use null for any side; in this case, the default side value for the plot margin side will be used.

plotInset

Inset for a plotting area, including the axes with their labels, but without titles. The inset may be specified using a number or a list of numbers:

  • a single number or a list of one number - the same inset is applied to all four sides;

  • a list of two numbers - the first inset applies to the top and bottom, the second - to the left and right;

  • a list of three numbers - the first inset applies to the top, the second - to the right and left, the third - to the bottom;

  • a list of four numbers - the insets are applied to the top, right, bottom and left in that order.

It is acceptable to use null for any side; in this case, the default value for the plot inset side will be used.

plotTitlePosition

default = "panel" ("panel", "plot"). Alignment of the plot title/subtitle. A value of "panel" means that title and subtitle are aligned to the plot panels. A value of "plot" means that title and subtitle are aligned to the entire plot (excluding margins).

plotCaptionPosition

default = "panel" ("panel", "plot"). Alignment of the plot caption. A value of "panel" means that caption is aligned to the plot panels. A value of "plot" means that caption is aligned to the entire plot (excluding margins).

stripBackground

Style settings for facet strip background.

stripBackgroundX

Style settings for horizontal facet strip background.

stripBackgroundY

Style settings for vertical facet strip background.

stripText

Style settings for facet labels.

stripTextX

Style settings for horizontal facet labels.

stripTextY

Style settings for vertical facet labels.

axisTooltip

Style settings for axes tooltips.

axisTooltipX

Style settings for axes tooltips.

axisTooltipY

Style settings for axes tooltips.

axisTooltipText

Style settings for text in axes tooltips.

axisTooltipTextX

Style settings for text in axes tooltips.

axisTooltipTextY

Style settings for text in axes tooltips.

tooltip

Style settings for general tooltip.

tooltipText

Style settings for text in general tooltip.

tooltipTitleText

Style settings for tooltip title text.

labelText

Style settings for annotation text. Annotations are currently supported for pie and bar charts. Set elementText() to specify annotation text parameters: font family and face, text size, text color (relevant for a pie chart - for those annotations that are outside the pie).

geom

Color settings for geometries.

Constructors

Link copied to clipboard
constructor(exponentFormat: Any? = null, line: Any? = null, rect: Any? = null, text: Any? = null, title: Any? = null, axis: Any? = null, axisOntop: Boolean? = null, axisOntopX: Boolean? = null, axisOntopY: Boolean? = null, axisTitle: Any? = null, axisTitleX: Any? = null, axisTitleY: Any? = null, axisText: Any? = null, axisTextX: Any? = null, axisTextY: Any? = null, axisTicks: Any? = null, axisTicksX: Any? = null, axisTicksY: Any? = null, axisTicksLength: Number? = null, axisTicksLengthX: Number? = null, axisTicksLengthY: Number? = null, axisTextSpacing: Number? = null, axisTextSpacingX: Number? = null, axisTextSpacingY: Number? = null, axisLine: Any? = null, axisLineX: Any? = null, axisLineY: Any? = null, legendBackground: Any? = null, legendText: Any? = null, legendTitle: Any? = null, legendMargin: Any? = null, legendSpacing: Number? = null, legendSpacingX: Number? = null, legendSpacingY: Number? = null, legendKey: Any? = null, legendKeySize: Number? = null, legendKeyWidth: Number? = null, legendKeyHeight: Number? = null, legendKeySpacing: Number? = null, legendKeySpacingX: Number? = null, legendKeySpacingY: Number? = null, legendBoxSpacing: Number? = null, legendTicks: Any? = null, legendTicksLength: Number? = null, panelBackground: Any? = null, panelBorder: Any? = null, panelBorderOntop: Boolean? = null, panelGrid: Any? = null, panelGridMajor: Any? = null, panelGridMinor: Any? = null, panelGridMajorX: Any? = null, panelGridMinorX: Any? = null, panelGridMajorY: Any? = null, panelGridMinorY: Any? = null, panelGridOntop: Boolean? = null, panelGridOntopX: Boolean? = null, panelGridOntopY: Boolean? = null, panelInset: Any? = null, plotBackground: Any? = null, plotTitle: Any? = null, plotSubtitle: Any? = null, plotCaption: Any? = null, plotMessage: Any? = null, plotMargin: Any? = null, plotInset: Any? = null, plotTitlePosition: Any? = null, plotCaptionPosition: Any? = null, stripBackground: Any? = null, stripBackgroundX: Any? = null, stripBackgroundY: Any? = null, stripText: Any? = null, stripTextX: Any? = null, stripTextY: Any? = null, axisTooltip: Any? = null, axisTooltipX: Any? = null, axisTooltipY: Any? = null, axisTooltipText: Any? = null, axisTooltipTextX: Any? = null, axisTooltipTextY: Any? = null, tooltip: Any? = null, tooltipText: Any? = null, tooltipTitleText: Any? = null, labelText: Any? = null, geom: Any? = null)

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Arrangement of multiple legends: horizontal or vertical.

Link copied to clipboard

Justification of each legend within the overall bounding box, when there are multiple legends.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun legendJustification(xanchor: Number, yanchor: Number): theme

Specifies the anchor point for positioning legend inside plot. Justification (0, 0) corresponds to the left, lower corner of the legend. Justification (1, 1) corresponds to the right, upper corner of the legend.

Link copied to clipboard
fun legendPosition(xpos: Number, ypos: Number): theme

Specifies the legend position relative to the plot drawing area. Position (0, 0) corresponds to the left, lower corner of the plot. Position (1, 1) corresponds to the right, upper corner of the plot.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard