pub struct Theme {Show 47 fields
pub text: ElementText,
pub title: ElementText,
pub axis_text_x: ElementText,
pub axis_text_y: ElementText,
pub axis_title_x: ElementText,
pub axis_title_y: ElementText,
pub axis_line: ElementLine,
pub axis_ticks: ElementLine,
pub panel_background: ElementRect,
pub panel_grid_major: ElementLine,
pub panel_grid_minor: ElementLine,
pub plot_background: ElementRect,
pub legend_position: LegendPosition,
pub plot_margin: Margin,
pub subtitle: ElementText,
pub caption: ElementText,
pub legend_title: ElementText,
pub legend_text: ElementText,
pub strip_text: ElementText,
pub axis_line_x: Option<ElementLine>,
pub axis_line_y: Option<ElementLine>,
pub axis_ticks_x: Option<ElementLine>,
pub axis_ticks_y: Option<ElementLine>,
pub panel_grid_major_x: Option<ElementLine>,
pub panel_grid_major_y: Option<ElementLine>,
pub panel_grid_minor_x: Option<ElementLine>,
pub panel_grid_minor_y: Option<ElementLine>,
pub panel_border: ElementLine,
pub legend_background: ElementRect,
pub legend_key: ElementRect,
pub strip_background: ElementRect,
pub axis_ticks_length: f64,
pub axis_text_x_dodge: usize,
pub legend_key_width: f64,
pub legend_key_height: f64,
pub legend_spacing: f64,
pub legend_margin: Margin,
pub panel_spacing: f64,
pub panel_spacing_x: Option<f64>,
pub panel_spacing_y: Option<f64>,
pub primary: Option<(u8, u8, u8)>,
pub aspect_ratio: Option<f64>,
pub panel_ontop: bool,
pub axis_minor_ticks: bool,
pub title_position: TitlePosition,
pub tag_position: TagPosition,
pub legend_direction: Option<LegendDirection>,
}Expand description
Complete theme specification for a plot.
Fields§
§text: ElementText§title: ElementText§axis_text_x: ElementText§axis_text_y: ElementText§axis_title_x: ElementText§axis_title_y: ElementText§axis_line: ElementLine§axis_ticks: ElementLine§panel_background: ElementRect§panel_grid_major: ElementLine§panel_grid_minor: ElementLine§plot_background: ElementRect§legend_position: LegendPosition§plot_margin: Margin§subtitle: ElementText§caption: ElementText§legend_title: ElementText§legend_text: ElementText§strip_text: ElementText§axis_line_x: Option<ElementLine>§axis_line_y: Option<ElementLine>§axis_ticks_x: Option<ElementLine>§axis_ticks_y: Option<ElementLine>§panel_grid_major_x: Option<ElementLine>§panel_grid_major_y: Option<ElementLine>§panel_grid_minor_x: Option<ElementLine>§panel_grid_minor_y: Option<ElementLine>§panel_border: ElementLine§legend_background: ElementRect§legend_key: ElementRect§strip_background: ElementRect§axis_ticks_length: f64§axis_text_x_dodge: usizeNumber of rows to stagger x-axis tick labels across (R’s
guide_axis(n.dodge = ...)); 1 = no dodging.
legend_key_width: f64§legend_key_height: f64§legend_spacing: f64§legend_margin: Margin§panel_spacing: f64§panel_spacing_x: Option<f64>§panel_spacing_y: Option<f64>§primary: Option<(u8, u8, u8)>Optional brand color. When set, geoms that draw a single un-mapped series (no color/fill aesthetic) use it as their default instead of the geom’s built-in color. Lets one render process serve multiple tenants’ brands.
aspect_ratio: Option<f64>Fix the panel’s height:width ratio (R’s aspect.ratio). None = free.
panel_ontop: boolDraw gridlines on top of the data layers (R’s panel.ontop).
axis_minor_ticks: boolDraw minor tick marks between major ticks (R’s axis.minor.ticks).
title_position: TitlePositionWhether title/subtitle/caption align to the panel or the whole plot
(R’s plot.title.position / plot.caption.position).
tag_position: TagPositionCorner for the labs(tag) label (R’s plot.tag.position).
legend_direction: Option<LegendDirection>Legend key layout direction; None = auto from legend_position.
Implementations§
Source§impl Theme
impl Theme
Sourcepub fn primary_or(&self, fallback: (u8, u8, u8)) -> (u8, u8, u8)
pub fn primary_or(&self, fallback: (u8, u8, u8)) -> (u8, u8, u8)
Resolve the effective series color: the theme’s brand color if set, otherwise the geom’s own default.
Sourcepub fn with_primary(self, color: (u8, u8, u8)) -> Self
pub fn with_primary(self, color: (u8, u8, u8)) -> Self
Set the brand/primary color (builder style).
Sourcepub fn resolve_inheritance(&mut self)
pub fn resolve_inheritance(&mut self)
Resolve R-style element inheritance: text-child elements still at the
default family/color inherit them from the root text element, so
setting only theme.text.family restyles every text element. Child
elements that already override a property keep it. Called once before
rendering.
pub fn get_axis_line_x(&self) -> &ElementLine
pub fn get_axis_line_y(&self) -> &ElementLine
pub fn get_axis_ticks_x(&self) -> &ElementLine
pub fn get_axis_ticks_y(&self) -> &ElementLine
pub fn get_panel_grid_major_x(&self) -> &ElementLine
pub fn get_panel_grid_major_y(&self) -> &ElementLine
pub fn get_panel_grid_minor_x(&self) -> &ElementLine
pub fn get_panel_grid_minor_y(&self) -> &ElementLine
pub fn get_panel_spacing_x(&self) -> f64
pub fn get_panel_spacing_y(&self) -> f64
pub fn set_axis_text_x(self, el: ElementText) -> Self
pub fn set_axis_text_y(self, el: ElementText) -> Self
pub fn set_axis_title_x(self, el: ElementText) -> Self
pub fn set_axis_title_y(self, el: ElementText) -> Self
pub fn set_axis_line(self, el: ElementLine) -> Self
pub fn set_axis_ticks(self, el: ElementLine) -> Self
pub fn set_panel_background(self, el: ElementRect) -> Self
pub fn set_panel_grid_major(self, el: ElementLine) -> Self
pub fn set_panel_grid_minor(self, el: ElementLine) -> Self
pub fn set_plot_background(self, el: ElementRect) -> Self
pub fn set_legend_position(self, pos: LegendPosition) -> Self
pub fn set_plot_margin(self, margin: Margin) -> Self
pub fn set_title(self, el: ElementText) -> Self
pub fn set_text(self, el: ElementText) -> Self
pub fn set_subtitle(self, el: ElementText) -> Self
pub fn set_caption(self, el: ElementText) -> Self
pub fn set_legend_title(self, el: ElementText) -> Self
pub fn set_legend_text(self, el: ElementText) -> Self
pub fn set_strip_text(self, el: ElementText) -> Self
pub fn set_axis_line_x(self, el: Option<ElementLine>) -> Self
pub fn set_axis_line_y(self, el: Option<ElementLine>) -> Self
pub fn set_axis_ticks_x(self, el: Option<ElementLine>) -> Self
pub fn set_axis_ticks_y(self, el: Option<ElementLine>) -> Self
pub fn set_panel_grid_major_x(self, el: Option<ElementLine>) -> Self
pub fn set_panel_grid_major_y(self, el: Option<ElementLine>) -> Self
pub fn set_panel_grid_minor_x(self, el: Option<ElementLine>) -> Self
pub fn set_panel_grid_minor_y(self, el: Option<ElementLine>) -> Self
pub fn set_panel_border(self, el: ElementLine) -> Self
pub fn set_legend_background(self, el: ElementRect) -> Self
pub fn set_legend_key(self, el: ElementRect) -> Self
pub fn set_strip_background(self, el: ElementRect) -> Self
pub fn set_axis_ticks_length(self, val: f64) -> Self
pub fn set_legend_key_width(self, val: f64) -> Self
pub fn set_legend_key_height(self, val: f64) -> Self
pub fn set_legend_spacing(self, val: f64) -> Self
pub fn set_legend_margin(self, margin: Margin) -> Self
pub fn set_panel_spacing(self, val: f64) -> Self
pub fn set_panel_spacing_x(self, val: Option<f64>) -> Self
pub fn set_panel_spacing_y(self, val: Option<f64>) -> Self
Sourcepub fn update(self, upd: ThemeUpdate) -> Self
pub fn update(self, upd: ThemeUpdate) -> Self
Apply incremental theme modifications.
Only fields that are Some in the update are applied.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Theme
impl RefUnwindSafe for Theme
impl Send for Theme
impl Sync for Theme
impl Unpin for Theme
impl UnsafeUnpin for Theme
impl UnwindSafe for Theme
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more