Skip to main content

Scatter3DPlot

Struct Scatter3DPlot 

Source
pub struct Scatter3DPlot {
    pub data: Vec<Scatter3DPoint>,
    pub color: String,
    pub size: f64,
    pub legend_label: Option<String>,
    pub marker: MarkerShape,
    pub sizes: Option<Vec<f64>>,
    pub colors: Option<Vec<String>>,
    pub marker_opacity: Option<f64>,
    pub marker_stroke_width: Option<f64>,
    pub depth_shade: bool,
    pub z_colormap: Option<ColorMap>,
    pub box3d: Box3DConfig,
}
Expand description

Builder for a 3D scatter plot.

Projects 3D data to 2D using orthographic projection with configurable view angles, then renders with the existing Scene/Primitive system. Renders its own wireframe box, floor grid, ticks, and axis labels — standard 2D axes are skipped.

§Example

use kuva::plot::scatter3d::Scatter3DPlot;
use kuva::backend::svg::SvgBackend;
use kuva::render::render::render_multiple;
use kuva::render::layout::Layout;
use kuva::render::plots::Plot;

let scatter = Scatter3DPlot::new()
    .with_data(vec![(1.0, 2.0, 3.0), (4.0, 5.0, 6.0), (7.0, 8.0, 9.0)])
    .with_color("steelblue");

let plots = vec![Plot::Scatter3D(scatter)];
let layout = Layout::auto_from_plots(&plots)
    .with_title("3D Scatter");

let svg = SvgBackend.render_scene(&render_multiple(plots, layout));
std::fs::write("scatter3d.svg", svg).unwrap();

Fields§

§data: Vec<Scatter3DPoint>§color: String

Uniform point color (CSS color string). Default "steelblue".

§size: f64

Marker radius in pixels. Default 3.0.

§legend_label: Option<String>

Legend label, if any.

§marker: MarkerShape

Marker shape. Default Circle.

§sizes: Option<Vec<f64>>

Per-point sizes (overrides size when set).

§colors: Option<Vec<String>>

Per-point colors (overrides color when set).

§marker_opacity: Option<f64>

Marker fill opacity (0.0–1.0).

§marker_stroke_width: Option<f64>

Marker stroke width.

§depth_shade: bool

Fade distant points for depth cue. Default false.

§z_colormap: Option<ColorMap>

Color points by Z value using a colormap.

§box3d: Box3DConfig

Shared 3D box/grid/axes configuration.

Implementations§

Source§

impl Scatter3DPlot

Source

pub fn new() -> Self

Create a 3D scatter plot with default settings.

Source

pub fn data_ranges(&self) -> Option<DataRanges3D>

Compute axis-aligned data ranges. Returns None if data is empty.

Source

pub fn with_data<I>(self, data: I) -> Self
where I: IntoIterator<Item = (f64, f64, f64)>,

Source

pub fn with_points(self, points: Vec<Scatter3DPoint>) -> Self

Source

pub fn with_color<S: Into<String>>(self, color: S) -> Self

Source

pub fn with_size(self, size: f64) -> Self

Source

pub fn with_legend<S: Into<String>>(self, label: S) -> Self

Source

pub fn with_marker(self, marker: MarkerShape) -> Self

Source

pub fn with_sizes(self, sizes: Vec<f64>) -> Self

Source

pub fn with_colors<I, S>(self, colors: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Source

pub fn with_marker_opacity(self, opacity: f64) -> Self

Source

pub fn with_marker_stroke_width(self, width: f64) -> Self

Source

pub fn with_depth_shade(self) -> Self

Source

pub fn with_z_colormap(self, cmap: ColorMap) -> Self

Source

pub fn with_azimuth(self, deg: f64) -> Self

Source

pub fn with_elevation(self, deg: f64) -> Self

Source

pub fn with_view(self, v: View3D) -> Self

Source

pub fn with_x_label<S: Into<String>>(self, l: S) -> Self

Source

pub fn with_y_label<S: Into<String>>(self, l: S) -> Self

Source

pub fn with_z_label<S: Into<String>>(self, l: S) -> Self

Source

pub fn with_no_grid(self) -> Self

Source

pub fn with_no_box(self) -> Self

Source

pub fn with_grid_lines(self, n: usize) -> Self

Source

pub fn with_z_axis_right(self, r: bool) -> Self

Source

pub fn with_z_axis_auto(self) -> Self

Trait Implementations§

Source§

impl Clone for Scatter3DPlot

Source§

fn clone(&self) -> Scatter3DPlot

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Scatter3DPlot

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Scatter3DPlot

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<Scatter3DPlot> for Plot

Source§

fn from(p: Scatter3DPlot) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Finish for T

Source§

fn finish(self)

Does nothing but move self, equivalent to drop.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<U, T> ToOwnedObj<U> for T
where U: FromObjRef<T>,

Source§

fn to_owned_obj(&self, data: FontData<'_>) -> U

Convert this type into T, using the provided data to resolve any offsets.
Source§

impl<U, T> ToOwnedTable<U> for T
where U: FromTableRef<T>,

Source§

fn to_owned_table(&self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.