pub struct Scatter3dPlot { /* private fields */ }Expand description
A structure representing a 3D scatter plot.
The Scatter3dPlot struct is designed to create and customize 3D scatter plots with options for data selection,
grouping, layout configuration, and aesthetic adjustments. It supports visual differentiation in data groups
through varied marker shapes, colors, sizes, opacity levels, and comprehensive layout customization, including
titles, axis labels, and legends.
§Arguments
data- A reference to theDataFramecontaining the data to be plotted.x- A string slice specifying the column name to be used for the x-axis (independent variable).y- A string slice specifying the column name to be used for the y-axis (dependent variable).z- A string slice specifying the column name to be used for the z-axis, adding a third dimension to the scatter plot.group- An optional string slice specifying the column name used for grouping data points by category.opacity- An optionalf64value specifying the opacity of the plot markers (range: 0.0 to 1.0).size- An optionalusizespecifying the size of the markers.color- An optionalRgbvalue for marker color whengroupis not specified.colors- An optional vector ofRgbvalues specifying colors for markers whengroupis specified, enhancing group distinction.shape- An optionalShapespecifying the shape of markers whengroupis not specified.shapes- An optional vector ofShapevalues defining multiple marker shapes for different groups.plot_title- An optionalTextstruct specifying the plot title.x_title- An optionalTextstruct for the x-axis title.y_title- An optionalTextstruct for the y-axis title.z_title- An optionalTextstruct for the z-axis title.legend_title- An optionalTextstruct specifying the legend title.x_axis- An optional reference to anAxisstruct for custom x-axis settings.y_axis- An optional reference to anAxisstruct for custom y-axis settings.z_axis- An optional reference to anAxisstruct for custom z-axis settings, adding depth perspective.legend- An optional reference to aLegendstruct for legend customization, including position and font settings.
§Example
use plotlars::{Legend, Plot, Rgb, Scatter3dPlot, Shape};
let dataset = LazyCsvReader::new("data/penguins.csv")
.finish()
.unwrap()
.select([
col("species"),
col("sex").alias("gender"),
col("bill_length_mm").cast(DataType::Float32),
col("flipper_length_mm").cast(DataType::Int16),
col("body_mass_g").cast(DataType::Int16),
])
.collect()
.unwrap();
Scatter3dPlot::builder()
.data(&dataset)
.x("body_mass_g")
.y("flipper_length_mm")
.z("bill_length_mm")
.group("species")
.opacity(0.25)
.size(8)
.colors(vec![
Rgb(178, 34, 34),
Rgb(65, 105, 225),
Rgb(255, 140, 0),
])
.shapes(vec![
Shape::Circle,
Shape::Square,
Shape::Diamond,
])
.plot_title("Scatter Plot")
.legend(
&Legend::new()
.x(0.6)
)
.build()
.plot();
Implementations§
Source§impl Scatter3dPlot
impl Scatter3dPlot
Trait Implementations§
Source§impl Clone for Scatter3dPlot
impl Clone for Scatter3dPlot
Source§fn clone(&self) -> Scatter3dPlot
fn clone(&self) -> Scatter3dPlot
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Scatter3dPlot
impl !RefUnwindSafe for Scatter3dPlot
impl !Send for Scatter3dPlot
impl !Sync for Scatter3dPlot
impl Unpin for Scatter3dPlot
impl !UnwindSafe for Scatter3dPlot
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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