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: StringUniform point color (CSS color string). Default "steelblue".
size: f64Marker radius in pixels. Default 3.0.
legend_label: Option<String>Legend label, if any.
marker: MarkerShapeMarker 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: boolFade distant points for depth cue. Default false.
z_colormap: Option<ColorMap>Color points by Z value using a colormap.
box3d: Box3DConfigShared 3D box/grid/axes configuration.
Implementations§
Source§impl Scatter3DPlot
impl Scatter3DPlot
Sourcepub fn data_ranges(&self) -> Option<DataRanges3D>
pub fn data_ranges(&self) -> Option<DataRanges3D>
Compute axis-aligned data ranges. Returns None if data is empty.
pub fn with_data<I>(self, data: I) -> Self
pub fn with_points(self, points: Vec<Scatter3DPoint>) -> Self
pub fn with_color<S: Into<String>>(self, color: S) -> Self
pub fn with_size(self, size: f64) -> Self
pub fn with_legend<S: Into<String>>(self, label: S) -> Self
pub fn with_marker(self, marker: MarkerShape) -> Self
pub fn with_sizes(self, sizes: Vec<f64>) -> Self
pub fn with_colors<I, S>(self, colors: I) -> Self
pub fn with_marker_opacity(self, opacity: f64) -> Self
pub fn with_marker_stroke_width(self, width: f64) -> Self
pub fn with_depth_shade(self) -> Self
pub fn with_z_colormap(self, cmap: ColorMap) -> Self
pub fn with_azimuth(self, deg: f64) -> Self
pub fn with_elevation(self, deg: f64) -> Self
pub fn with_view(self, v: View3D) -> Self
pub fn with_x_label<S: Into<String>>(self, l: S) -> Self
pub fn with_y_label<S: Into<String>>(self, l: S) -> Self
pub fn with_z_label<S: Into<String>>(self, l: S) -> Self
pub fn with_no_grid(self) -> Self
pub fn with_no_box(self) -> Self
pub fn with_grid_lines(self, n: usize) -> Self
pub fn with_z_axis_right(self, r: bool) -> Self
pub fn with_z_axis_auto(self) -> Self
Trait Implementations§
Source§impl Clone for Scatter3DPlot
impl Clone for Scatter3DPlot
Source§fn clone(&self) -> Scatter3DPlot
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Scatter3DPlot
impl Debug for Scatter3DPlot
Source§impl Default for Scatter3DPlot
impl Default for Scatter3DPlot
Source§impl From<Scatter3DPlot> for Plot
impl From<Scatter3DPlot> for Plot
Source§fn from(p: Scatter3DPlot) -> Self
fn from(p: Scatter3DPlot) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Scatter3DPlot
impl !RefUnwindSafe for Scatter3DPlot
impl Send for Scatter3DPlot
impl Sync for Scatter3DPlot
impl Unpin for Scatter3DPlot
impl UnsafeUnpin 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<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
Convert this type into
T, using the provided data to resolve any offsets.