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: boolAxis scales
y_log: bool§axis_equal: boolAxis aspect handling
colormap: ColorMapGlobal 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: usizeSubplot grid configuration (rows x cols). Defaults to 1x1.
axes_cols: usize§active_axes_index: usizeThe 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
impl Figure
pub fn set_active_axes_index(&mut self, axes_index: usize)
pub fn axes_metadata(&self, axes_index: usize) -> Option<&AxesMetadata>
pub fn active_axes_metadata(&self) -> Option<&AxesMetadata>
Sourcepub fn with_title<S: Into<String>>(self, title: S) -> Self
pub fn with_title<S: Into<String>>(self, title: S) -> Self
Set the figure title
Sourcepub fn with_labels<S: Into<String>>(self, x_label: S, y_label: S) -> Self
pub fn with_labels<S: Into<String>>(self, x_label: S, y_label: S) -> Self
Set axis labels
Sourcepub fn set_axis_labels<S: Into<String>>(&mut self, x_label: S, y_label: S)
pub fn set_axis_labels<S: Into<String>>(&mut self, x_label: S, y_label: S)
Set axis labels in-place
pub fn set_axes_title<S: Into<String>>(&mut self, axes_index: usize, title: S)
pub fn set_axes_xlabel<S: Into<String>>(&mut self, axes_index: usize, label: S)
pub fn set_axes_ylabel<S: Into<String>>(&mut self, axes_index: usize, label: S)
pub fn set_axes_zlabel<S: Into<String>>(&mut self, axes_index: usize, label: S)
pub fn add_axes_text_annotation<S: Into<String>>( &mut self, axes_index: usize, position: Vec3, text: S, style: TextStyle, ) -> usize
pub fn axes_text_annotation( &self, axes_index: usize, annotation_index: usize, ) -> Option<&TextAnnotation>
pub fn set_axes_text_annotation_text<S: Into<String>>( &mut self, axes_index: usize, annotation_index: usize, text: S, )
pub fn set_axes_text_annotation_position( &mut self, axes_index: usize, annotation_index: usize, position: Vec3, )
pub fn set_axes_text_annotation_style( &mut self, axes_index: usize, annotation_index: usize, style: TextStyle, )
pub fn axes_text_annotations(&self, axes_index: usize) -> &[TextAnnotation]
pub fn set_axes_labels<S: Into<String>>( &mut self, axes_index: usize, x_label: S, y_label: S, )
pub fn set_axes_title_style(&mut self, axes_index: usize, style: TextStyle)
pub fn set_axes_xlabel_style(&mut self, axes_index: usize, style: TextStyle)
pub fn set_axes_ylabel_style(&mut self, axes_index: usize, style: TextStyle)
pub fn set_axes_zlabel_style(&mut self, axes_index: usize, style: TextStyle)
Sourcepub fn with_limits(self, x_limits: (f64, f64), y_limits: (f64, f64)) -> Self
pub fn with_limits(self, x_limits: (f64, f64), y_limits: (f64, f64)) -> Self
Set axis limits manually
Sourcepub fn with_legend(self, enabled: bool) -> Self
pub fn with_legend(self, enabled: bool) -> Self
Enable or disable the legend
pub fn set_legend(&mut self, enabled: bool)
pub fn set_axes_legend_enabled(&mut self, axes_index: usize, enabled: bool)
pub fn set_axes_legend_style(&mut self, axes_index: usize, style: LegendStyle)
pub fn set_axes_log_modes( &mut self, axes_index: usize, x_log: bool, y_log: bool, )
pub fn set_axes_view( &mut self, axes_index: usize, azimuth_deg: f32, elevation_deg: f32, )
pub fn set_grid(&mut self, enabled: bool)
pub fn set_axes_grid_enabled(&mut self, axes_index: usize, enabled: bool)
Sourcepub fn with_background_color(self, color: Vec4) -> Self
pub fn with_background_color(self, color: Vec4) -> Self
Set background color
pub fn with_ylog(self, enabled: bool) -> Self
pub fn with_axis_equal(self, enabled: bool) -> Self
pub fn set_axis_equal(&mut self, enabled: bool)
pub fn set_axes_axis_equal(&mut self, axes_index: usize, enabled: bool)
pub fn with_colormap(self, cmap: ColorMap) -> Self
pub fn with_colorbar(self, enabled: bool) -> Self
pub fn with_color_limits(self, limits: Option<(f64, f64)>) -> Self
Sourcepub fn with_subplot_grid(self, rows: usize, cols: usize) -> Self
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.
Sourcepub fn plot_axes_indices(&self) -> &[usize]
pub fn plot_axes_indices(&self) -> &[usize]
Axes index mapping for plots (length equals number of plots)
Sourcepub fn assign_plot_to_axes(
&mut self,
plot_index: usize,
axes_index: usize,
) -> Result<(), String>
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
Sourcepub fn set_subplot_grid(&mut self, rows: usize, cols: usize)
pub fn set_subplot_grid(&mut self, rows: usize, cols: usize)
Mutably set subplot grid (rows x cols)
Sourcepub fn set_color_limits(&mut self, limits: Option<(f64, f64)>)
pub fn set_color_limits(&mut self, limits: Option<(f64, f64)>)
Set color limits and propagate to existing surface plots
pub fn set_z_limits(&mut self, limits: Option<(f64, f64)>)
pub fn set_axes_limits( &mut self, axes_index: usize, x: Option<(f64, f64)>, y: Option<(f64, f64)>, )
pub fn set_axes_z_limits( &mut self, axes_index: usize, limits: Option<(f64, f64)>, )
pub fn set_axes_box_enabled(&mut self, axes_index: usize, enabled: bool)
pub fn set_axes_colorbar_enabled(&mut self, axes_index: usize, enabled: bool)
pub fn set_axes_colormap(&mut self, axes_index: usize, cmap: ColorMap)
pub fn set_axes_color_limits( &mut self, axes_index: usize, limits: Option<(f64, f64)>, )
Sourcepub fn add_line_plot(&mut self, plot: LinePlot) -> usize
pub fn add_line_plot(&mut self, plot: LinePlot) -> usize
Add a line plot to the figure
pub fn add_line_plot_on_axes( &mut self, plot: LinePlot, axes_index: usize, ) -> usize
Sourcepub fn add_scatter_plot(&mut self, plot: ScatterPlot) -> usize
pub fn add_scatter_plot(&mut self, plot: ScatterPlot) -> usize
Add a scatter plot to the figure
pub fn add_scatter_plot_on_axes( &mut self, plot: ScatterPlot, axes_index: usize, ) -> usize
Sourcepub fn add_bar_chart(&mut self, plot: BarChart) -> usize
pub fn add_bar_chart(&mut self, plot: BarChart) -> usize
Add a bar chart to the figure
pub fn add_bar_chart_on_axes( &mut self, plot: BarChart, axes_index: usize, ) -> usize
Sourcepub fn add_errorbar(&mut self, plot: ErrorBar) -> usize
pub fn add_errorbar(&mut self, plot: ErrorBar) -> usize
Add an errorbar plot
pub fn add_errorbar_on_axes( &mut self, plot: ErrorBar, axes_index: usize, ) -> usize
Sourcepub fn add_stairs_plot(&mut self, plot: StairsPlot) -> usize
pub fn add_stairs_plot(&mut self, plot: StairsPlot) -> usize
Add a stairs plot
pub fn add_stairs_plot_on_axes( &mut self, plot: StairsPlot, axes_index: usize, ) -> usize
Sourcepub fn add_stem_plot(&mut self, plot: StemPlot) -> usize
pub fn add_stem_plot(&mut self, plot: StemPlot) -> usize
Add a stem plot
pub fn add_stem_plot_on_axes( &mut self, plot: StemPlot, axes_index: usize, ) -> usize
Sourcepub fn add_area_plot(&mut self, plot: AreaPlot) -> usize
pub fn add_area_plot(&mut self, plot: AreaPlot) -> usize
Add an area plot
pub fn add_area_plot_on_axes( &mut self, plot: AreaPlot, axes_index: usize, ) -> usize
pub fn add_quiver_plot(&mut self, plot: QuiverPlot) -> usize
pub fn add_quiver_plot_on_axes( &mut self, plot: QuiverPlot, axes_index: usize, ) -> usize
pub fn add_pie_chart(&mut self, plot: PieChart) -> usize
pub fn add_pie_chart_on_axes( &mut self, plot: PieChart, axes_index: usize, ) -> usize
Sourcepub fn add_surface_plot(&mut self, plot: SurfacePlot) -> usize
pub fn add_surface_plot(&mut self, plot: SurfacePlot) -> usize
Add a surface plot to the figure
pub fn add_surface_plot_on_axes( &mut self, plot: SurfacePlot, axes_index: usize, ) -> usize
pub fn add_line3_plot(&mut self, plot: Line3Plot) -> usize
pub fn add_line3_plot_on_axes( &mut self, plot: Line3Plot, axes_index: usize, ) -> usize
Sourcepub fn add_scatter3_plot(&mut self, plot: Scatter3Plot) -> usize
pub fn add_scatter3_plot(&mut self, plot: Scatter3Plot) -> usize
Add a 3D scatter plot to the figure
pub fn add_scatter3_plot_on_axes( &mut self, plot: Scatter3Plot, axes_index: usize, ) -> usize
pub fn add_contour_plot(&mut self, plot: ContourPlot) -> usize
pub fn add_contour_plot_on_axes( &mut self, plot: ContourPlot, axes_index: usize, ) -> usize
pub fn add_contour_fill_plot(&mut self, plot: ContourFillPlot) -> usize
pub fn add_contour_fill_plot_on_axes( &mut self, plot: ContourFillPlot, axes_index: usize, ) -> usize
Sourcepub fn clear_axes(&mut self, axes_index: usize)
pub fn clear_axes(&mut self, axes_index: usize)
Clear all plots assigned to a specific axes index
Sourcepub fn plots(&self) -> impl Iterator<Item = &PlotElement>
pub fn plots(&self) -> impl Iterator<Item = &PlotElement>
Get an iterator over all plots in this figure
Sourcepub fn get_plot_mut(&mut self, index: usize) -> Option<&mut PlotElement>
pub fn get_plot_mut(&mut self, index: usize) -> Option<&mut PlotElement>
Get a mutable reference to a plot
Sourcepub fn bounds(&mut self) -> BoundingBox
pub fn bounds(&mut self) -> BoundingBox
Get the combined bounds of all visible plots
Sourcepub fn render_data(&mut self) -> Vec<RenderData>
pub fn render_data(&mut self) -> Vec<RenderData>
Generate all render data for all visible plots
Sourcepub fn render_data_with_viewport(
&mut self,
viewport_px: Option<(u32, u32)>,
) -> Vec<RenderData>
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.
pub fn render_data_with_viewport_and_gpu( &mut self, viewport_px: Option<(u32, u32)>, gpu: Option<&GpuPackContext<'_>>, ) -> Vec<RenderData>
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)>
Sourcepub fn legend_entries(&self) -> Vec<LegendEntry>
pub fn legend_entries(&self) -> Vec<LegendEntry>
Get legend entries for all labeled plots
pub fn legend_entries_for_axes(&self, axes_index: usize) -> Vec<LegendEntry>
pub fn pie_labels_for_axes(&self, axes_index: usize) -> Vec<PieLabelEntry>
Sourcepub fn set_labels(&mut self, labels: &[String])
pub fn set_labels(&mut self, labels: &[String])
Assign labels to visible plots in order
pub fn set_labels_for_axes(&mut self, axes_index: usize, labels: &[String])
Sourcepub fn statistics(&self) -> FigureStatistics
pub fn statistics(&self) -> FigureStatistics
Get figure statistics
Sourcepub fn categorical_axis_labels(&self) -> Option<(bool, Vec<String>)>
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).
pub fn categorical_axis_labels_for_axes( &self, axes_index: usize, ) -> Option<(bool, Vec<String>)>
pub fn histogram_axis_edges_for_axes( &self, axes_index: usize, ) -> Option<(bool, Vec<f64>)>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Figure
impl !RefUnwindSafe for Figure
impl Send for Figure
impl Sync for Figure
impl Unpin for Figure
impl UnsafeUnpin for Figure
impl !UnwindSafe for Figure
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().