Skip to content

theme

theme(
    *,
    exponent_format: str
    | tuple[str, int | None, int | None]
    | None = None,
    line: ThemeElement | None = None,
    rect: ThemeElement | None = None,
    text: ThemeElement | None = None,
    title: ThemeElement | None = None,
    axis: ThemeElement | None = None,
    axis_ontop: bool | None = None,
    axis_ontop_x: bool | None = None,
    axis_ontop_y: bool | None = None,
    axis_title: ThemeElement | None = None,
    axis_title_x: ThemeElement | None = None,
    axis_title_y: ThemeElement | None = None,
    axis_text: ThemeElement | None = None,
    axis_text_x: ThemeElement | None = None,
    axis_text_y: ThemeElement | None = None,
    axis_text_spacing: Number | None = None,
    axis_text_spacing_x: Number | None = None,
    axis_text_spacing_y: Number | None = None,
    axis_ticks: ThemeElement | None = None,
    axis_ticks_x: ThemeElement | None = None,
    axis_ticks_y: ThemeElement | None = None,
    axis_minor_ticks: ThemeElement | None = None,
    axis_minor_ticks_x: ThemeElement | None = None,
    axis_minor_ticks_y: ThemeElement | None = None,
    axis_ticks_length: Number | None = None,
    axis_ticks_length_x: Number | None = None,
    axis_ticks_length_y: Number | None = None,
    axis_minor_ticks_length: Number | None = None,
    axis_minor_ticks_length_x: Number | None = None,
    axis_minor_ticks_length_y: Number | None = None,
    axis_line: ThemeElement | None = None,
    axis_line_x: ThemeElement | None = None,
    axis_line_y: ThemeElement | None = None,
    legend_background: ThemeElement | None = None,
    legend_text: ThemeElement | None = None,
    legend_title: ThemeElement | None = None,
    legend_position: str | Sequence[Number] | None = None,
    legend_justification: str
    | Sequence[Number]
    | None = None,
    legend_direction: Literal[horizontal, vertical]
    | None = None,
    legend_margin: Margins | None = None,
    legend_spacing: Number | None = None,
    legend_spacing_x: Number | None = None,
    legend_spacing_y: Number | None = None,
    legend_key: ThemeElement | None = None,
    legend_key_size: Number | None = None,
    legend_key_width: Number | None = None,
    legend_key_height: Number | None = None,
    legend_key_spacing: Number | None = None,
    legend_key_spacing_x: Number | None = None,
    legend_key_spacing_y: Number | None = None,
    legend_box: Literal[horizontal, vertical] | None = None,
    legend_box_just: str | None = None,
    legend_box_spacing: Number | None = None,
    legend_ticks: ThemeElement | None = None,
    legend_ticks_length: Number | None = None,
    panel_background: ThemeElement | None = None,
    panel_border: ThemeElement | None = None,
    panel_border_ontop: bool | None = None,
    panel_grid: ThemeElement | None = None,
    panel_grid_ontop: bool | None = None,
    panel_grid_ontop_x: bool | None = None,
    panel_grid_ontop_y: bool | None = None,
    panel_grid_major: ThemeElement | None = None,
    panel_grid_minor: ThemeElement | None = None,
    panel_grid_major_x: ThemeElement | None = None,
    panel_grid_minor_x: ThemeElement | None = None,
    panel_grid_major_y: ThemeElement | None = None,
    panel_grid_minor_y: ThemeElement | None = None,
    panel_inset: Margins | None = None,
    plot_background: ThemeElement | None = None,
    plot_title: ThemeElement | None = None,
    plot_subtitle: ThemeElement | None = None,
    plot_caption: ThemeElement | None = None,
    plot_tag: ThemeElement | None = None,
    plot_message: ThemeElement | None = None,
    plot_margin: Margins | None = None,
    plot_inset: Margins | None = None,
    plot_title_position: Literal[panel, plot] | None = None,
    plot_caption_position: Literal[panel, plot]
    | None = None,
    plot_tag_position: str | Sequence[Number] | None = None,
    plot_tag_location: str | None = None,
    plot_tag_prefix: str | None = None,
    plot_tag_suffix: str | None = None,
    strip_background: ThemeElement | None = None,
    strip_background_x: ThemeElement | None = None,
    strip_background_y: ThemeElement | None = None,
    strip_text: ThemeElement | None = None,
    strip_text_x: ThemeElement | None = None,
    strip_text_y: ThemeElement | None = None,
    strip_spacing: Number | None = None,
    strip_spacing_x: Number | None = None,
    strip_spacing_y: Number | None = None,
    panel_spacing: Number | None = None,
    panel_spacing_x: Number | None = None,
    panel_spacing_y: Number | None = None,
    axis_tooltip: ThemeElement | None = None,
    axis_tooltip_x: ThemeElement | None = None,
    axis_tooltip_y: ThemeElement | None = None,
    axis_tooltip_text: ThemeElement | None = None,
    axis_tooltip_text_x: ThemeElement | None = None,
    axis_tooltip_text_y: ThemeElement | None = None,
    tooltip: ThemeElement | None = None,
    tooltip_text: ThemeElement | None = None,
    tooltip_title_text: ThemeElement | None = None,
    tooltip_merge: bool | None = None,
    tooltip_max_count: int | None = None,
    label_text: ThemeElement | None = None,
    geom: Mapping[str, Any] | None = None,
) -> FeatureSpec

Set theme options: element_*() values, numbers or names per theme element.

Every parameter is keyword-only, named and valued as in lets_plot theme() (axis_text_x=element_text(size=10), legend_position="bottom", panel_grid=element_blank(), ...). Parameters left as None are not set. Element parameters take an element_*() value, or "blank" to hide the element. _x / _y variants override the shared one for one axis.

Parameters:

  • exponent_format (str or tuple, default: None ) –

    How large and small numbers are written: "e" (1e+06), "pow" (10^6), "pow_full", or (format, min_exponent, max_exponent).

  • line (dict or str, default: None ) –

    Root elements every line, rectangle, text and title inherits from.

  • rect (dict or str, default: None ) –

    Root elements every line, rectangle, text and title inherits from.

  • text (dict or str, default: None ) –

    Root elements every line, rectangle, text and title inherits from.

  • title (dict or str, default: None ) –

    Root elements every line, rectangle, text and title inherits from.

  • axis (dict or str, default: None ) –

    Every part of both axes.

  • axis_ontop (bool, default: None ) –

    True draws the axis over the plot layers.

  • axis_ontop_x (bool, default: None ) –

    True draws the axis over the plot layers.

  • axis_ontop_y (bool, default: None ) –

    True draws the axis over the plot layers.

  • axis_title (dict or str, default: None ) –

    Axis titles (element_text()).

  • axis_title_x (dict or str, default: None ) –

    Axis titles (element_text()).

  • axis_title_y (dict or str, default: None ) –

    Axis titles (element_text()).

  • axis_text (dict or str, default: None ) –

    Tick labels (element_text()).

  • axis_text_x (dict or str, default: None ) –

    Tick labels (element_text()).

  • axis_text_y (dict or str, default: None ) –

    Tick labels (element_text()).

  • axis_text_spacing (float, default: None ) –

    Space between the ticks and their labels, in pixels.

  • axis_text_spacing_x (float, default: None ) –

    Space between the ticks and their labels, in pixels.

  • axis_text_spacing_y (float, default: None ) –

    Space between the ticks and their labels, in pixels.

  • axis_ticks (dict or str, default: None ) –

    Major ticks (element_line()).

  • axis_ticks_x (dict or str, default: None ) –

    Major ticks (element_line()).

  • axis_ticks_y (dict or str, default: None ) –

    Major ticks (element_line()).

  • axis_minor_ticks (dict or str, default: None ) –

    Minor ticks (element_line()).

  • axis_minor_ticks_x (dict or str, default: None ) –

    Minor ticks (element_line()).

  • axis_minor_ticks_y (dict or str, default: None ) –

    Minor ticks (element_line()).

  • axis_ticks_length (float, default: None ) –

    Length of the major ticks, in pixels.

  • axis_ticks_length_x (float, default: None ) –

    Length of the major ticks, in pixels.

  • axis_ticks_length_y (float, default: None ) –

    Length of the major ticks, in pixels.

  • axis_minor_ticks_length (float, default: None ) –

    Length of the minor ticks, in pixels.

  • axis_minor_ticks_length_x (float, default: None ) –

    Length of the minor ticks, in pixels.

  • axis_minor_ticks_length_y (float, default: None ) –

    Length of the minor ticks, in pixels.

  • axis_line (dict or str, default: None ) –

    Axis lines (element_line()).

  • axis_line_x (dict or str, default: None ) –

    Axis lines (element_line()).

  • axis_line_y (dict or str, default: None ) –

    Axis lines (element_line()).

  • legend_background (dict or str, default: None ) –

    Legend box (element_rect()), key labels and title (element_text()).

  • legend_text (dict or str, default: None ) –

    Legend box (element_rect()), key labels and title (element_text()).

  • legend_title (dict or str, default: None ) –

    Legend box (element_rect()), key labels and title (element_text()).

  • legend_position (str or list of float, default: None ) –

    "right", "left", "top", "bottom", "none", or [x, y] inside the plot (0 to 1).

  • legend_justification (str or list of float, default: None ) –

    Anchor of the legend box: a name such as "center", or [x, y].

  • legend_direction ((horizontal, vertical), default: "horizontal" ) –

    Layout of the legend keys.

  • legend_margin (float or list of float, default: None ) –

    Margins around the legend, in pixels (one number, or 2 to 4 as in CSS).

  • legend_spacing (float, default: None ) –

    Space between legends, in pixels.

  • legend_spacing_x (float, default: None ) –

    Space between legends, in pixels.

  • legend_spacing_y (float, default: None ) –

    Space between legends, in pixels.

  • legend_key (dict or str, default: None ) –

    Background of the legend keys (element_rect()).

  • legend_key_size (float, default: None ) –

    Size of the legend keys, in pixels.

  • legend_key_width (float, default: None ) –

    Size of the legend keys, in pixels.

  • legend_key_height (float, default: None ) –

    Size of the legend keys, in pixels.

  • legend_key_spacing (float, default: None ) –

    Space between legend keys, in pixels.

  • legend_key_spacing_x (float, default: None ) –

    Space between legend keys, in pixels.

  • legend_key_spacing_y (float, default: None ) –

    Space between legend keys, in pixels.

  • legend_box ((horizontal, vertical), default: "horizontal" ) –

    Arrangement of several legends.

  • legend_box_just (str, default: None ) –

    Justification of the legends within their box.

  • legend_box_spacing (float, default: None ) –

    Space between the plot panel and the legend box, in pixels.

  • legend_ticks (dict or str, default: None ) –

    Ticks of the color bar (element_line()).

  • legend_ticks_length (float, default: None ) –

    Length of the color bar ticks, in pixels.

  • panel_background (dict or str, default: None ) –

    Panel background and border (element_rect()).

  • panel_border (dict or str, default: None ) –

    Panel background and border (element_rect()).

  • panel_border_ontop (bool, default: None ) –

    True draws the border over the plot layers.

  • panel_grid (dict or str, default: None ) –

    Grid lines (element_line()).

  • panel_grid_major (dict or str, default: None ) –

    Grid lines (element_line()).

  • panel_grid_minor (dict or str, default: None ) –

    Grid lines (element_line()).

  • panel_grid_major_x (dict or str, default: None ) –

    Grid lines of the x axis.

  • panel_grid_minor_x (dict or str, default: None ) –

    Grid lines of the x axis.

  • panel_grid_major_y (dict or str, default: None ) –

    Grid lines of the y axis.

  • panel_grid_minor_y (dict or str, default: None ) –

    Grid lines of the y axis.

  • panel_grid_ontop (bool, default: None ) –

    True draws the grid over the plot layers.

  • panel_grid_ontop_x (bool, default: None ) –

    True draws the grid over the plot layers.

  • panel_grid_ontop_y (bool, default: None ) –

    True draws the grid over the plot layers.

  • panel_inset (float or list of float, default: None ) –

    Inner margins of the panel, in pixels.

  • plot_background (dict or str, default: None ) –

    Background of the whole plot (element_rect()).

  • plot_title (dict or str, default: None ) –

    Title, subtitle, caption and tag texts (element_text()).

  • plot_subtitle (dict or str, default: None ) –

    Title, subtitle, caption and tag texts (element_text()).

  • plot_caption (dict or str, default: None ) –

    Title, subtitle, caption and tag texts (element_text()).

  • plot_tag (dict or str, default: None ) –

    Title, subtitle, caption and tag texts (element_text()).

  • plot_message (dict or str, default: None ) –

    Messages shown on the plot (lets_plot); "blank" hides them.

  • plot_margin (float or list of float, default: None ) –

    Outer and inner margins of the plot, in pixels.

  • plot_inset (float or list of float, default: None ) –

    Outer and inner margins of the plot, in pixels.

  • plot_title_position ((panel, plot), default: "panel" ) –

    Align the title or caption with the panel or with the whole plot.

  • plot_caption_position ((panel, plot), default: "panel" ) –

    Align the title or caption with the panel or with the whole plot.

  • plot_tag_position (str or list of float, default: None ) –

    Where the tag goes: a side name such as "topleft", or [x, y].

  • plot_tag_location (str, default: None ) –

    What the tag position is relative to: "panel", "plot" or "margin".

  • plot_tag_prefix (str, default: None ) –

    Text added before and after the tag.

  • plot_tag_suffix (str, default: None ) –

    Text added before and after the tag.

  • strip_background (dict or str, default: None ) –

    Facet strip backgrounds (element_rect()).

  • strip_background_x (dict or str, default: None ) –

    Facet strip backgrounds (element_rect()).

  • strip_background_y (dict or str, default: None ) –

    Facet strip backgrounds (element_rect()).

  • strip_text (dict or str, default: None ) –

    Facet strip texts (element_text()).

  • strip_text_x (dict or str, default: None ) –

    Facet strip texts (element_text()).

  • strip_text_y (dict or str, default: None ) –

    Facet strip texts (element_text()).

  • strip_spacing (float, default: None ) –

    Space between the strips and the panels, in pixels.

  • strip_spacing_x (float, default: None ) –

    Space between the strips and the panels, in pixels.

  • strip_spacing_y (float, default: None ) –

    Space between the strips and the panels, in pixels.

  • panel_spacing (float, default: None ) –

    Space between facet panels, in pixels.

  • panel_spacing_x (float, default: None ) –

    Space between facet panels, in pixels.

  • panel_spacing_y (float, default: None ) –

    Space between facet panels, in pixels.

  • axis_tooltip (dict or str, default: None ) –

    Axis tooltips of HTML output (element_rect()).

  • axis_tooltip_x (dict or str, default: None ) –

    Axis tooltips of HTML output (element_rect()).

  • axis_tooltip_y (dict or str, default: None ) –

    Axis tooltips of HTML output (element_rect()).

  • axis_tooltip_text (dict or str, default: None ) –

    Text of the axis tooltips (element_text()).

  • axis_tooltip_text_x (dict or str, default: None ) –

    Text of the axis tooltips (element_text()).

  • axis_tooltip_text_y (dict or str, default: None ) –

    Text of the axis tooltips (element_text()).

  • tooltip (dict or str, default: None ) –

    Tooltip box, text and title text of HTML output.

  • tooltip_text (dict or str, default: None ) –

    Tooltip box, text and title text of HTML output.

  • tooltip_title_text (dict or str, default: None ) –

    Tooltip box, text and title text of HTML output.

  • tooltip_merge (bool, default: None ) –

    lets_plot's tooltip merging option.

  • tooltip_max_count (int, default: None ) –

    Maximum number of tooltips shown at once.

  • label_text (dict or str, default: None ) –

    Text of geom_label() labels (element_text()).

  • geom (dict, default: None ) –

    Default geom colors, from element_geom().

Returns:

  • FeatureSpec –

    The theme feature.