Skip to main content

Axes

Struct Axes 

Source
pub struct Axes {
    pub xlim: (f64, f64),
    pub ylim: (f64, f64),
    pub xticks: Vec<f64>,
    pub yticks: Vec<f64>,
    pub xlabel: String,
    pub ylabel: String,
    pub title: String,
    /* private fields */
}
Expand description

Axis limits, ticks, labels, and title for a plot.

Fields§

§xlim: (f64, f64)

Lower and upper x-axis limits.

§ylim: (f64, f64)

Lower and upper y-axis limits.

§xticks: Vec<f64>

Tick values shown on the x axis.

§yticks: Vec<f64>

Tick values shown on the y axis.

§xlabel: String

Label drawn beneath the plot.

§ylabel: String

Label drawn beside the plot.

§title: String

Plot title.

Implementations§

Source§

impl Axes

Source

pub fn new() -> Self

Creates a new axis configuration with automatic limits and default labels.

Source

pub fn from_limits(xlim: (f64, f64), ylim: (f64, f64)) -> Self

Creates a new axes configuration from explicit x/y limits.

Source

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

Sets the x-axis limits while keeping the builder pattern.

Source

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

Sets the y-axis limits while keeping the builder pattern.

Source

pub fn labels(self, x: impl Into<String>, y: impl Into<String>) -> Self

Sets the x and y axis labels while keeping the builder pattern.

Source

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

Sets the plot title while keeping the builder pattern.

Source

pub fn x_ticks(self, ticks: impl IntoIterator<Item = f64>) -> Self

Replaces the x-axis tick positions with explicit values.

Source

pub fn y_ticks(self, ticks: impl IntoIterator<Item = f64>) -> Self

Replaces the y-axis tick positions with explicit values.

Source

pub fn with_xlim(self, xlim: (f64, f64)) -> Self

Sets the x-axis limits and disables automatic rescaling for that axis.

Source

pub fn with_ylim(self, ylim: (f64, f64)) -> Self

Sets the y-axis limits and disables automatic rescaling for that axis.

Source

pub fn set_xlim(&mut self, xlim: (f64, f64))

Sets the x-axis limits and disables automatic rescaling for that axis.

Source

pub fn set_ylim(&mut self, ylim: (f64, f64))

Sets the y-axis limits and disables automatic rescaling for that axis.

Source

pub fn use_auto_xlim(&mut self)

Re-enables automatic fitting for the x-axis.

Source

pub fn use_auto_ylim(&mut self)

Re-enables automatic fitting for the y-axis.

Source

pub fn with_labels( self, xlabel: impl Into<String>, ylabel: impl Into<String>, ) -> Self

Sets the x and y axis labels.

Source

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

Sets the plot title.

Trait Implementations§

Source§

impl Clone for Axes

Source§

fn clone(&self) -> Axes

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 Debug for Axes

Source§

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

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

impl Default for Axes

Source§

fn default() -> Self

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

impl PartialEq for Axes

Source§

fn eq(&self, other: &Axes) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Axes

Auto Trait Implementations§

§

impl Freeze for Axes

§

impl RefUnwindSafe for Axes

§

impl Send for Axes

§

impl Sync for Axes

§

impl Unpin for Axes

§

impl UnsafeUnpin for Axes

§

impl UnwindSafe for Axes

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.