pub trait Geom: Send + Sync {
// Required methods
fn draw(
&self,
data: &DataFrame,
coord: &dyn Coord,
scales: &ScaleSet,
theme: &Theme,
backend: &mut dyn DrawBackend,
) -> Result<(), RenderError>;
fn required_aes(&self) -> Vec<Aesthetic>;
fn default_stat(&self) -> Box<dyn Stat>;
fn default_position(&self) -> Box<dyn Position>;
fn default_params(&self) -> GeomParams;
fn name(&self) -> &str;
// Provided method
fn set_series_color(&mut self, _color: (u8, u8, u8)) { ... }
}Expand description
Trait for geometric objects that draw data on the plot.
Required Methods§
Sourcefn draw(
&self,
data: &DataFrame,
coord: &dyn Coord,
scales: &ScaleSet,
theme: &Theme,
backend: &mut dyn DrawBackend,
) -> Result<(), RenderError>
fn draw( &self, data: &DataFrame, coord: &dyn Coord, scales: &ScaleSet, theme: &Theme, backend: &mut dyn DrawBackend, ) -> Result<(), RenderError>
Draw this geometry.
Sourcefn required_aes(&self) -> Vec<Aesthetic>
fn required_aes(&self) -> Vec<Aesthetic>
Required aesthetics.
Sourcefn default_stat(&self) -> Box<dyn Stat>
fn default_stat(&self) -> Box<dyn Stat>
Default stat for this geom.
Sourcefn default_position(&self) -> Box<dyn Position>
fn default_position(&self) -> Box<dyn Position>
Default position adjustment.
Sourcefn default_params(&self) -> GeomParams
fn default_params(&self) -> GeomParams
Non-mapped visual defaults.
Provided Methods§
Sourcefn set_series_color(&mut self, _color: (u8, u8, u8))
fn set_series_color(&mut self, _color: (u8, u8, u8))
Apply a brand/primary color to this geom’s single-series default (its
color or fill). The build pipeline calls this only when the layer has
no color/fill aesthetic mapped, so an explicit mapping always wins. The
default is a no-op; series geoms override it.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".