pub struct ScatterArtist {
pub x: Series,
pub y: Series,
pub color: Color,
pub marker: Marker,
pub size: f64,
pub label: Option<String>,
pub alpha: f64,
pub colors: Option<Vec<Color>>,
pub c: Option<Vec<f64>>,
pub cmap: Option<Colormap>,
}Expand description
A scatter plot rendering individual markers at (x, y) positions.
Each data point is drawn as a marker whose shape, size, and color can be
configured. An optional per-point colors vector overrides the uniform
color field, enabling colormap-based visualizations.
Fields§
§x: SeriesX-coordinates of the data points.
y: SeriesY-coordinates of the data points.
color: ColorDefault marker color (used when colors is None).
marker: MarkerMarker shape.
size: f64Marker diameter in pixels.
label: Option<String>Optional legend label. When Some, the scatter appears in the legend.
alpha: f64Opacity from 0.0 (fully transparent) to 1.0 (fully opaque).
colors: Option<Vec<Color>>Optional per-point colors for colormap-driven scatter plots.
When set, colors.len() must equal x.len() (and y.len()). Each
entry overrides color for the corresponding data point.
c: Option<Vec<f64>>Optional per-point scalar values for colormap-driven coloring.
When set together with cmap, each value is mapped through the
colormap to produce per-point colors. Takes precedence over colors.
cmap: Option<Colormap>Optional colormap used to map c values to colors.
Implementations§
Source§impl ScatterArtist
impl ScatterArtist
Source§impl ScatterArtist
impl ScatterArtist
Sourcepub fn label(&mut self, label: &str) -> &mut Self
pub fn label(&mut self, label: &str) -> &mut Self
Sets the legend label for this scatter series.
When a label is set, the scatter series will appear in the legend if one is displayed on the axes. Pass an empty string or omit this call to exclude the series from the legend.
§Arguments
label- A string slice that will be stored as the legend entry.
§Examples
artist.label("Measurements");Sourcepub fn colors(&mut self, colors: Vec<Color>) -> &mut Self
pub fn colors(&mut self, colors: Vec<Color>) -> &mut Self
Sets per-point colors, overriding the single uniform color.
When set, each data point is rendered with its corresponding color
from the vector. The length of colors must equal the number of
data points (x.len() and y.len()). This is commonly used to
map a third variable to a colormap.
Calling color after this method does not clear the
per-point colors; the per-point colors take precedence during
rendering.
§Arguments
colors- A vector ofColorvalues, one per data point.
§Examples
artist.colors(vec![Color::TAB_BLUE, Color::TAB_RED, Color::TAB_GREEN]);Sourcepub fn c(&mut self, c: Vec<f64>) -> &mut Self
pub fn c(&mut self, c: Vec<f64>) -> &mut Self
Sets per-point scalar values for colormap-driven coloring.
When combined with cmap, each scalar value is mapped
through the colormap to produce a per-point color. The length of c
must equal the number of data points. This takes precedence over
both the uniform color and colors.
§Arguments
c- A vector of scalar values, one per data point.
§Examples
artist.c(vec![0.0, 0.5, 1.0]).cmap(Colormap::Viridis);Sourcepub fn cmap(&mut self, cmap: Colormap) -> &mut Self
pub fn cmap(&mut self, cmap: Colormap) -> &mut Self
Sets the colormap used to map c values to colors.
Must be used together with c to have any effect. When
both are set, the scatter plot renders each point with a color
determined by mapping its c value through the given colormap.
§Arguments
cmap- TheColormapvariant to use.
§Examples
artist.c(values).cmap(Colormap::Plasma);Trait Implementations§
Source§impl Clone for ScatterArtist
impl Clone for ScatterArtist
Source§fn clone(&self) -> ScatterArtist
fn clone(&self) -> ScatterArtist
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more