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: StringLabel drawn beneath the plot.
ylabel: StringLabel drawn beside the plot.
title: StringPlot title.
Implementations§
Source§impl Axes
impl Axes
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new axis configuration with automatic limits and default labels.
Sourcepub fn from_limits(xlim: (f64, f64), ylim: (f64, f64)) -> Self
pub fn from_limits(xlim: (f64, f64), ylim: (f64, f64)) -> Self
Creates a new axes configuration from explicit x/y limits.
Sourcepub fn x_limits(self, limits: (f64, f64)) -> Self
pub fn x_limits(self, limits: (f64, f64)) -> Self
Sets the x-axis limits while keeping the builder pattern.
Sourcepub fn y_limits(self, limits: (f64, f64)) -> Self
pub fn y_limits(self, limits: (f64, f64)) -> Self
Sets the y-axis limits while keeping the builder pattern.
Sourcepub fn labels(self, x: impl Into<String>, y: impl Into<String>) -> Self
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.
Sourcepub fn title(self, title: impl Into<String>) -> Self
pub fn title(self, title: impl Into<String>) -> Self
Sets the plot title while keeping the builder pattern.
Sourcepub fn x_ticks(self, ticks: impl IntoIterator<Item = f64>) -> Self
pub fn x_ticks(self, ticks: impl IntoIterator<Item = f64>) -> Self
Replaces the x-axis tick positions with explicit values.
Sourcepub fn y_ticks(self, ticks: impl IntoIterator<Item = f64>) -> Self
pub fn y_ticks(self, ticks: impl IntoIterator<Item = f64>) -> Self
Replaces the y-axis tick positions with explicit values.
Sourcepub fn with_xlim(self, xlim: (f64, f64)) -> Self
pub fn with_xlim(self, xlim: (f64, f64)) -> Self
Sets the x-axis limits and disables automatic rescaling for that axis.
Sourcepub fn with_ylim(self, ylim: (f64, f64)) -> Self
pub fn with_ylim(self, ylim: (f64, f64)) -> Self
Sets the y-axis limits and disables automatic rescaling for that axis.
Sourcepub fn set_xlim(&mut self, xlim: (f64, f64))
pub fn set_xlim(&mut self, xlim: (f64, f64))
Sets the x-axis limits and disables automatic rescaling for that axis.
Sourcepub fn set_ylim(&mut self, ylim: (f64, f64))
pub fn set_ylim(&mut self, ylim: (f64, f64))
Sets the y-axis limits and disables automatic rescaling for that axis.
Sourcepub fn use_auto_xlim(&mut self)
pub fn use_auto_xlim(&mut self)
Re-enables automatic fitting for the x-axis.
Sourcepub fn use_auto_ylim(&mut self)
pub fn use_auto_ylim(&mut self)
Re-enables automatic fitting for the y-axis.
Sourcepub fn with_labels(
self,
xlabel: impl Into<String>,
ylabel: impl Into<String>,
) -> Self
pub fn with_labels( self, xlabel: impl Into<String>, ylabel: impl Into<String>, ) -> Self
Sets the x and y axis labels.
Sourcepub fn with_title(self, title: impl Into<String>) -> Self
pub fn with_title(self, title: impl Into<String>) -> Self
Sets the plot title.