Skip to main content

Figure

Struct Figure 

Source
pub struct Figure {
Show 21 fields pub title: Option<String>, pub x_label: Option<String>, pub y_label: Option<String>, pub z_label: Option<String>, pub legend_enabled: bool, pub grid_enabled: bool, pub box_enabled: bool, pub background_color: Vec4, pub x_limits: Option<(f64, f64)>, pub y_limits: Option<(f64, f64)>, pub z_limits: Option<(f64, f64)>, pub x_log: bool, pub y_log: bool, pub axis_equal: bool, pub colormap: ColorMap, pub colorbar_enabled: bool, pub color_limits: Option<(f64, f64)>, pub axes_rows: usize, pub axes_cols: usize, pub active_axes_index: usize, pub axes_metadata: Vec<AxesMetadata>, /* private fields */
}
Expand description

A figure that can contain multiple overlaid plots

Fields§

§title: Option<String>

Figure-level settings

§x_label: Option<String>§y_label: Option<String>§z_label: Option<String>§legend_enabled: bool§grid_enabled: bool§box_enabled: bool§background_color: Vec4§x_limits: Option<(f64, f64)>

Axis limits (None = auto-scale)

§y_limits: Option<(f64, f64)>§z_limits: Option<(f64, f64)>§x_log: bool

Axis scales

§y_log: bool§axis_equal: bool

Axis aspect handling

§colormap: ColorMap

Global colormap and colorbar

§colorbar_enabled: bool§color_limits: Option<(f64, f64)>

Color mapping limits for all color-mapped plots in this figure (caxis)

§axes_rows: usize

Subplot grid configuration (rows x cols). Defaults to 1x1.

§axes_cols: usize§active_axes_index: usize

The axes index whose annotation metadata is currently active.

§axes_metadata: Vec<AxesMetadata>

Per-axes metadata used for subplot-correct annotations and legend state.

Implementations§

Source§

impl Figure

Source

pub fn new() -> Self

Create a new empty figure

Source

pub fn set_active_axes_index(&mut self, axes_index: usize)

Source

pub fn axes_metadata(&self, axes_index: usize) -> Option<&AxesMetadata>

Source

pub fn active_axes_metadata(&self) -> Option<&AxesMetadata>

Source

pub fn with_title<S: Into<String>>(self, title: S) -> Self

Set the figure title

Source

pub fn set_title<S: Into<String>>(&mut self, title: S)

Set the figure title in-place

Source

pub fn with_labels<S: Into<String>>(self, x_label: S, y_label: S) -> Self

Set axis labels

Source

pub fn set_axis_labels<S: Into<String>>(&mut self, x_label: S, y_label: S)

Set axis labels in-place

Source

pub fn set_axes_title<S: Into<String>>(&mut self, axes_index: usize, title: S)

Source

pub fn set_axes_xlabel<S: Into<String>>(&mut self, axes_index: usize, label: S)

Source

pub fn set_axes_ylabel<S: Into<String>>(&mut self, axes_index: usize, label: S)

Source

pub fn set_axes_zlabel<S: Into<String>>(&mut self, axes_index: usize, label: S)

Source

pub fn add_axes_text_annotation<S: Into<String>>( &mut self, axes_index: usize, position: Vec3, text: S, style: TextStyle, ) -> usize

Source

pub fn axes_text_annotation( &self, axes_index: usize, annotation_index: usize, ) -> Option<&TextAnnotation>

Source

pub fn set_axes_text_annotation_text<S: Into<String>>( &mut self, axes_index: usize, annotation_index: usize, text: S, )

Source

pub fn set_axes_text_annotation_position( &mut self, axes_index: usize, annotation_index: usize, position: Vec3, )

Source

pub fn set_axes_text_annotation_style( &mut self, axes_index: usize, annotation_index: usize, style: TextStyle, )

Source

pub fn axes_text_annotations(&self, axes_index: usize) -> &[TextAnnotation]

Source

pub fn set_axes_labels<S: Into<String>>( &mut self, axes_index: usize, x_label: S, y_label: S, )

Source

pub fn set_axes_title_style(&mut self, axes_index: usize, style: TextStyle)

Source

pub fn set_axes_xlabel_style(&mut self, axes_index: usize, style: TextStyle)

Source

pub fn set_axes_ylabel_style(&mut self, axes_index: usize, style: TextStyle)

Source

pub fn set_axes_zlabel_style(&mut self, axes_index: usize, style: TextStyle)

Source

pub fn with_limits(self, x_limits: (f64, f64), y_limits: (f64, f64)) -> Self

Set axis limits manually

Source

pub fn with_legend(self, enabled: bool) -> Self

Enable or disable the legend

Source

pub fn set_legend(&mut self, enabled: bool)

Source

pub fn set_axes_legend_enabled(&mut self, axes_index: usize, enabled: bool)

Source

pub fn set_axes_legend_style(&mut self, axes_index: usize, style: LegendStyle)

Source

pub fn set_axes_log_modes( &mut self, axes_index: usize, x_log: bool, y_log: bool, )

Source

pub fn set_axes_view( &mut self, axes_index: usize, azimuth_deg: f32, elevation_deg: f32, )

Source

pub fn with_grid(self, enabled: bool) -> Self

Enable or disable the grid

Source

pub fn set_grid(&mut self, enabled: bool)

Source

pub fn set_axes_grid_enabled(&mut self, axes_index: usize, enabled: bool)

Source

pub fn with_background_color(self, color: Vec4) -> Self

Set background color

Source

pub fn with_xlog(self, enabled: bool) -> Self

Set log scale flags

Source

pub fn with_ylog(self, enabled: bool) -> Self

Source

pub fn with_axis_equal(self, enabled: bool) -> Self

Source

pub fn set_axis_equal(&mut self, enabled: bool)

Source

pub fn set_axes_axis_equal(&mut self, axes_index: usize, enabled: bool)

Source

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

Source

pub fn with_colorbar(self, enabled: bool) -> Self

Source

pub fn with_color_limits(self, limits: Option<(f64, f64)>) -> Self

Source

pub fn with_subplot_grid(self, rows: usize, cols: usize) -> Self

Configure subplot grid (rows x cols). Axes are indexed row-major starting at 0.

Source

pub fn axes_grid(&self) -> (usize, usize)

Return subplot grid (rows, cols)

Source

pub fn plot_axes_indices(&self) -> &[usize]

Axes index mapping for plots (length equals number of plots)

Source

pub fn assign_plot_to_axes( &mut self, plot_index: usize, axes_index: usize, ) -> Result<(), String>

Assign a specific plot (by index) to an axes index in the subplot grid

Source

pub fn set_subplot_grid(&mut self, rows: usize, cols: usize)

Mutably set subplot grid (rows x cols)

Source

pub fn set_color_limits(&mut self, limits: Option<(f64, f64)>)

Set color limits and propagate to existing surface plots

Source

pub fn set_z_limits(&mut self, limits: Option<(f64, f64)>)

Source

pub fn set_axes_limits( &mut self, axes_index: usize, x: Option<(f64, f64)>, y: Option<(f64, f64)>, )

Source

pub fn set_axes_z_limits( &mut self, axes_index: usize, limits: Option<(f64, f64)>, )

Source

pub fn set_axes_box_enabled(&mut self, axes_index: usize, enabled: bool)

Source

pub fn set_axes_colorbar_enabled(&mut self, axes_index: usize, enabled: bool)

Source

pub fn set_axes_colormap(&mut self, axes_index: usize, cmap: ColorMap)

Source

pub fn set_axes_color_limits( &mut self, axes_index: usize, limits: Option<(f64, f64)>, )

Source

pub fn add_line_plot(&mut self, plot: LinePlot) -> usize

Add a line plot to the figure

Source

pub fn add_line_plot_on_axes( &mut self, plot: LinePlot, axes_index: usize, ) -> usize

Source

pub fn add_scatter_plot(&mut self, plot: ScatterPlot) -> usize

Add a scatter plot to the figure

Source

pub fn add_scatter_plot_on_axes( &mut self, plot: ScatterPlot, axes_index: usize, ) -> usize

Source

pub fn add_bar_chart(&mut self, plot: BarChart) -> usize

Add a bar chart to the figure

Source

pub fn add_bar_chart_on_axes( &mut self, plot: BarChart, axes_index: usize, ) -> usize

Source

pub fn add_errorbar(&mut self, plot: ErrorBar) -> usize

Add an errorbar plot

Source

pub fn add_errorbar_on_axes( &mut self, plot: ErrorBar, axes_index: usize, ) -> usize

Source

pub fn add_stairs_plot(&mut self, plot: StairsPlot) -> usize

Add a stairs plot

Source

pub fn add_stairs_plot_on_axes( &mut self, plot: StairsPlot, axes_index: usize, ) -> usize

Source

pub fn add_stem_plot(&mut self, plot: StemPlot) -> usize

Add a stem plot

Source

pub fn add_stem_plot_on_axes( &mut self, plot: StemPlot, axes_index: usize, ) -> usize

Source

pub fn add_area_plot(&mut self, plot: AreaPlot) -> usize

Add an area plot

Source

pub fn add_area_plot_on_axes( &mut self, plot: AreaPlot, axes_index: usize, ) -> usize

Source

pub fn add_quiver_plot(&mut self, plot: QuiverPlot) -> usize

Source

pub fn add_quiver_plot_on_axes( &mut self, plot: QuiverPlot, axes_index: usize, ) -> usize

Source

pub fn add_pie_chart(&mut self, plot: PieChart) -> usize

Source

pub fn add_pie_chart_on_axes( &mut self, plot: PieChart, axes_index: usize, ) -> usize

Source

pub fn add_surface_plot(&mut self, plot: SurfacePlot) -> usize

Add a surface plot to the figure

Source

pub fn add_surface_plot_on_axes( &mut self, plot: SurfacePlot, axes_index: usize, ) -> usize

Source

pub fn add_line3_plot(&mut self, plot: Line3Plot) -> usize

Source

pub fn add_line3_plot_on_axes( &mut self, plot: Line3Plot, axes_index: usize, ) -> usize

Source

pub fn add_scatter3_plot(&mut self, plot: Scatter3Plot) -> usize

Add a 3D scatter plot to the figure

Source

pub fn add_scatter3_plot_on_axes( &mut self, plot: Scatter3Plot, axes_index: usize, ) -> usize

Source

pub fn add_contour_plot(&mut self, plot: ContourPlot) -> usize

Source

pub fn add_contour_plot_on_axes( &mut self, plot: ContourPlot, axes_index: usize, ) -> usize

Source

pub fn add_contour_fill_plot(&mut self, plot: ContourFillPlot) -> usize

Source

pub fn add_contour_fill_plot_on_axes( &mut self, plot: ContourFillPlot, axes_index: usize, ) -> usize

Source

pub fn remove_plot(&mut self, index: usize) -> Result<(), String>

Remove a plot by index

Source

pub fn clear(&mut self)

Clear all plots

Source

pub fn clear_axes(&mut self, axes_index: usize)

Clear all plots assigned to a specific axes index

Source

pub fn len(&self) -> usize

Get the number of plots

Source

pub fn is_empty(&self) -> bool

Check if figure has no plots

Source

pub fn plots(&self) -> impl Iterator<Item = &PlotElement>

Get an iterator over all plots in this figure

Source

pub fn get_plot_mut(&mut self, index: usize) -> Option<&mut PlotElement>

Get a mutable reference to a plot

Source

pub fn bounds(&mut self) -> BoundingBox

Get the combined bounds of all visible plots

Source

pub fn render_data(&mut self) -> Vec<RenderData>

Generate all render data for all visible plots

Source

pub fn render_data_with_viewport( &mut self, viewport_px: Option<(u32, u32)>, ) -> Vec<RenderData>

Generate all render data for all visible plots, optionally providing the pixel size of the target viewport (width, height).

Some plot types (notably thick 2D lines) need a viewport hint to convert pixel-based style parameters (e.g. LineWidth) into data-space geometry.

Source

pub fn render_data_with_viewport_and_gpu( &mut self, viewport_px: Option<(u32, u32)>, gpu: Option<&GpuPackContext<'_>>, ) -> Vec<RenderData>

Source

pub fn render_data_with_axes_with_viewport_and_gpu( &mut self, viewport_px: Option<(u32, u32)>, axes_viewports_px: Option<&[(u32, u32)]>, gpu: Option<&GpuPackContext<'_>>, ) -> Vec<(usize, RenderData)>

Source

pub fn legend_entries(&self) -> Vec<LegendEntry>

Get legend entries for all labeled plots

Source

pub fn legend_entries_for_axes(&self, axes_index: usize) -> Vec<LegendEntry>

Source

pub fn pie_labels_for_axes(&self, axes_index: usize) -> Vec<PieLabelEntry>

Source

pub fn set_labels(&mut self, labels: &[String])

Assign labels to visible plots in order

Source

pub fn set_labels_for_axes(&mut self, axes_index: usize, labels: &[String])

Source

pub fn statistics(&self) -> FigureStatistics

Get figure statistics

Source

pub fn categorical_axis_labels(&self) -> Option<(bool, Vec<String>)>

If the figure contains a bar/barh plot, return its categorical axis labels. Returns (is_x_axis, labels) where is_x_axis=true means X is categorical (vertical bars), false means Y is categorical (horizontal bars).

Source

pub fn categorical_axis_labels_for_axes( &self, axes_index: usize, ) -> Option<(bool, Vec<String>)>

Source

pub fn histogram_axis_edges_for_axes( &self, axes_index: usize, ) -> Option<(bool, Vec<f64>)>

Trait Implementations§

Source§

impl Clone for Figure

Source§

fn clone(&self) -> Figure

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Figure

Source§

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

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

impl Default for Figure

Source§

fn default() -> Self

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

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

Source§

fn downcast(&self) -> &T

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = 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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

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

Source§

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

Source§

impl<T> WasmNotSendSync for T

Source§

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