Skip to main content

FigureState

Struct FigureState 

Source
pub struct FigureState {
Show 30 fields pub xlabel: Option<String>, pub ylabel: Option<String>, pub zlabel: Option<String>, pub title: Option<String>, pub legend: Vec<String>, pub xlim: Option<(f64, f64)>, pub ylim: Option<(f64, f64)>, pub zlim: Option<(f64, f64)>, pub grid: bool, pub colormap: Option<ColormapSpec>, pub colorbar: bool, pub subplot: Option<(u32, u32, u32)>, pub hold: bool, pub pending_series: Vec<PendingSeries>, pub panels: Vec<Panel>, pub annotations: Vec<(f64, f64, String)>, pub theme: Option<Theme>, pub bg_color: Option<StyleColor>, pub font_size: Option<u32>, pub line_width: Option<f32>, pub marker_size: Option<u32>, pub grid_color: Option<StyleColor>, pub grid_width: Option<f32>, pub axis_mode: Option<AxisMode>, pub figure_size: Option<(u32, u32)>, pub active_yaxis: YAxis, pub right_pending_series: Vec<PendingSeries>, pub right_ylim: Option<(f64, f64)>, pub right_ylabel: Option<String>, pub clabel: bool,
}
Expand description

Per-figure annotation and accumulation state.

Annotations (xlabel, title, …) are set via their corresponding functions and consumed at the next render call (or at hold('off') / savefig when in accumulating mode).

Fields§

§xlabel: Option<String>

X-axis label.

§ylabel: Option<String>

Y-axis label.

§zlabel: Option<String>

Z-axis label (consumed only by plot3 / scatter3).

§title: Option<String>

Chart title.

§legend: Vec<String>

Series labels for legend boxes (file export only).

§xlim: Option<(f64, f64)>

Override x-axis range [min, max].

§ylim: Option<(f64, f64)>

Override y-axis range [min, max].

§zlim: Option<(f64, f64)>

Override z-axis range [min, max] (3D only).

§grid: bool

Whether to draw grid lines (file export only; ASCII ignores).

§colormap: Option<ColormapSpec>

Active colormap for imagesc (default ColormapSpec::Named("viridis") when None).

§colorbar: bool

Whether to append a colorbar to the next imagesc render.

§subplot: Option<(u32, u32, u32)>

Active subplot grid position (rows, cols, index_1based).

§hold: bool

When true, plot calls accumulate into Self::pending_series.

§pending_series: Vec<PendingSeries>

Series accumulated for the current in-progress panel.

§panels: Vec<Panel>

Committed panels waiting for savefig.

§annotations: Vec<(f64, f64, String)>

Text annotations accumulated for the current render (flushed at render time).

§theme: Option<Theme>

Active colour theme (None means use the light default).

§bg_color: Option<StyleColor>

Per-figure background colour override (beats the theme background).

§font_size: Option<u32>

Title and axis-label font size override in points (minimum 8).

§line_width: Option<f32>

Stroke width override for all line series (pixels).

§marker_size: Option<u32>

Marker radius override for scatter / marker series (pixels).

§grid_color: Option<StyleColor>

Grid line colour override (applied to both bold and light grid lines).

§grid_width: Option<f32>

Grid line stroke width override in pixels.

§axis_mode: Option<AxisMode>

Axis display mode (axis('equal'), axis('tight'), axis('off')).

§figure_size: Option<(u32, u32)>

Output canvas size in pixels (width, height) for file export.

None falls back to the default 800×600. Set via figure(w, h). Persists across panels; cleared only when the whole state is reset.

§active_yaxis: YAxis

Which Y axis receives new series and annotation calls.

§right_pending_series: Vec<PendingSeries>

Series accumulated for the right (secondary) Y axis.

§right_ylim: Option<(f64, f64)>

Override for the right Y axis range.

§right_ylabel: Option<String>

Label for the right Y axis.

§clabel: bool

When true, the next contour render places a text label at each level.

Implementations§

Source§

impl FigureState

Source

pub fn canvas_size(&self) -> (u32, u32)

Returns the canvas size in pixels, falling back to 800×600 if not set.

Source

pub fn resolve_theme(&self) -> Theme

Returns the resolved active Theme: explicit theme field > light default.

Source

pub fn effective_bg_rgb(&self) -> (u8, u8, u8)

Returns the effective background colour as an RGB triple.

Resolution order: explicit bg_color override > active theme background.

Source

pub fn push_series(&mut self, series: PendingSeries)

Pushes series to the left or right pending queue based on Self::active_yaxis.

Trait Implementations§

Source§

impl Clone for FigureState

Source§

fn clone(&self) -> FigureState

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 Default for FigureState

Source§

fn default() -> FigureState

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> 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<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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V