Skip to main content

Series3D

Struct Series3D 

Source
pub struct Series3D<'a> { /* private fields */ }
Expand description

One named 3D data set. Build it with Series3D::line, Series3D::scatter, Series3D::bars, Series3D::surface, or Series3D::surface_fn, then add it to a super::Plot3D.

Implementations§

Source§

impl<'a> Series3D<'a>

Source

pub fn line( name: impl Into<String>, data: impl Into<Cow<'a, [[f64; 3]]>>, ) -> Self

A polyline through [x, y, z] points, in order.

Source

pub fn scatter( name: impl Into<String>, data: impl Into<Cow<'a, [[f64; 3]]>>, ) -> Self

Unconnected 3D markers.

Source

pub fn bars( name: impl Into<String>, data: impl Into<Cow<'a, [[f64; 3]]>>, ) -> Self

Vertical bars from the z base (0 by default) to each [x, y, z] point.

Source

pub fn surface( name: impl Into<String>, x: impl Into<Cow<'a, [f64]>>, y: impl Into<Cow<'a, [f64]>>, z: impl Into<Cow<'a, [f64]>>, ) -> Self

A surface over the grid x × y with row-major z.

let x = vec![-1.0, 0.0, 1.0];
let y = vec![-1.0, 0.0, 1.0];
let z = vec![0.0, 1.0, 0.0, 1.0, 2.0, 1.0, 0.0, 1.0, 0.0];
let mut state = Plot3DState::default();
Plot3D::new("terrain")
    .series(Series3D::surface("terrain", x.clone(), y.clone(), z.clone()))
    .show(ui, &mut icons, &mut state);
Source

pub fn surface_fn( name: impl Into<String>, x_range: RangeInclusive<f64>, y_range: RangeInclusive<f64>, samples: [usize; 2], f: impl Fn(f64, f64) -> f64, ) -> Series3D<'static>

A surface sampled columns × rows times over two ranges.

Source

pub fn color(self, color: Color32) -> Self

Explicit color; the theme palette is used in order otherwise.

Source

pub fn width(self, width: f32) -> Self

Line width in points.

Source

pub fn style(self, style: LineStyle) -> Self

Solid, dashed, or dotted lines.

Source

pub fn marker(self, marker: Marker) -> Self

A marker on every line vertex, or the scatter marker.

Source

pub fn radius(self, radius: f32) -> Self

Marker radius in points.

Source

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

Bar footprint in data units; the smallest x/y gap × 0.7 when None.

Source

pub fn base(self, base: f64) -> Self

Where bars start (default 0).

Source

pub fn hide_from_legend(self) -> Self

Leave the series out of the legend.

Source

pub fn name(&self) -> &str

The series name (also the legend label).

Source

pub fn data(&self) -> &[[f64; 3]]

The points, for line, scatter, and bar series (empty for surfaces).

Source

pub fn surface_grid(&self) -> Option<&Surface<'a>>

The surface grid, when this is a surface series.

Source

pub fn point(&self, index: usize) -> Option<[f64; 3]>

One data point by index: a grid vertex for surfaces.

Source

pub fn len(&self) -> usize

How many points the series has, including surface vertices.

Source

pub fn is_empty(&self) -> bool

Whether the series has no points.

Trait Implementations§

Source§

impl<'a> Clone for Series3D<'a>

Source§

fn clone(&self) -> Self

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<'a> Debug for Series3D<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Forget for Series3D<'a>

§

impl<'a> Freeze for Series3D<'a>
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze, &'a [[f64; 3]]: Freeze, Vec<[f64; 3]>: Freeze, &'a [f64]: Freeze, Vec<f64>: Freeze,

§

impl<'a> Move for Series3D<'a>

§

impl<'a> RefUnwindSafe for Series3D<'a>

§

impl<'a> Send for Series3D<'a>
where RawVecInner: Send, &'a [[f64; 3]]: Send, Vec<[f64; 3]>: Send, &'a [f64]: Send, Vec<f64>: Send,

§

impl<'a> Sync for Series3D<'a>
where RawVecInner: Sync, Vec<[f64; 3]>: Sync, Vec<f64>: Sync,

§

impl<'a> Unpin for Series3D<'a>
where *const u8 is !null: Unpin, &'a [[f64; 3]]: Unpin, Vec<[f64; 3]>: Unpin, &'a [f64]: Unpin, Vec<f64>: Unpin,

§

impl<'a> UnsafeUnpin for Series3D<'a>

§

impl<'a> UnwindSafe for Series3D<'a>
where RawVecInner: UnwindSafe, &'a [[f64; 3]]: UnwindSafe, Vec<[f64; 3]>: UnwindSafe, &'a [f64]: UnwindSafe, Vec<f64>: UnwindSafe,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,