Skip to main content

Axes

Struct Axes 

Source
pub struct Axes { /* private fields */ }
Expand description

One subplot inside an oa::plot::Figure.

Implementations§

Source§

impl Axes

Source

pub fn title(&mut self, text: &str)

Set the axes title rendered above its plot region.

color with alpha zero (the default) uses the theme text color.

Source

pub fn title_color(&mut self, text: &str, color: Color)

Set the axes title with an explicit text color.

Source

pub fn caption(&mut self, text: &str)

Set the secondary caption line below the title.

Used by the image-classify tutorial to show the ground-truth label. Alpha-zero color uses the theme secondary text color.

Source

pub fn caption_color(&mut self, text: &str, color: Color)

Set caption with an explicit text color.

Source

pub fn x_label(&mut self, text: &str)

Set the horizontal axis label centered below the tick labels.

Source

pub fn y_label(&mut self, text: &str)

Set the vertical axis label, read bottom-to-top to the left of the ticks.

Source

pub fn imshow(&mut self, texture: Texture)

Display a texture as a raster base for this axes. Standalone images fit inside the subplot with their aspect ratio preserved.

Source

pub fn heatmap( &mut self, values: &[f32], rows: i32, cols: i32, style: HeatmapStyle, )

Dense row-major heatmap. Donor: oa::plot::Axes::heatmap.

Source

pub fn heatmap_matrix(&mut self, values: Matrix, style: HeatmapStyle)

Dense device-resident heatmap from a rank-2 F32 oa::Matrix.

The matrix stays on the GPU; replay lowers it to one draw_heatmap dispatch through the UI compositor. style.auto_scale cannot inspect device data — callers must supply an explicit v_min/v_max range or replay fails validation.

Source

pub fn plot(&mut self, y: &[f32], style: LineStyle)

Line plot: y-values vs index. Repeated calls append ordered series.

Source

pub fn plot_xy(&mut self, x: &[f32], y: &[f32], style: LineStyle)

Explicit X/Y line plot.

Source

pub fn plot_matrix(&mut self, values: &Matrix, style: LineStyle)

Device-resident explicit-XY line series from an F32 [2, N] oa::Matrix laid out as one X block followed by one Y block.

The matrix stays on the GPU and is retained until composition completes. Device data cannot be inspected host-side: the series does not contribute to automatic limits (set limits explicitly or record a host artist as well) and requires linear axes — a logarithmic axis fails at replay rather than silently drawing untransformed data.

Source

pub fn plot_matrix_y(&mut self, values: &Matrix, style: LineStyle)

Device-resident y-vs-index line series from an F32 [N] oa::Matrix.

Same device-resident contract as Axes::plot_matrix; x positions are the sample indices 0..N-1, which do contribute to automatic x limits.

Source

pub fn annotate(&mut self, text: &str, x: f32, y: f32)

Data-space text annotation anchored at (x, y).

The text renders just above the data point; non-finite or scale-dropped points are skipped at replay.

Source

pub fn categories(&mut self, labels: &[&str])

Category labels replacing numeric x tick labels at bar positions.

Pass one label per bar slot; an empty list restores numeric ticks.

Source

pub fn xscale(&mut self, scale: Scale)

Set the x axis scaling (default: linear).

Source

pub fn yscale(&mut self, scale: Scale)

Set the y axis scaling (default: linear).

Source

pub fn xticks(&mut self, values: &[f32])

Explicit x tick positions in data space.

Positions map through the x scale at replay — a Log10 axis drops non-positive values — and share grid placement with the labels. An empty slice restores the automatic nice-number locator.

Source

pub fn yticks(&mut self, values: &[f32])

Explicit y tick positions in data space; see Axes::xticks.

Source

pub fn xformat(&mut self, format: TickFormat)

Label presentation for explicit Axes::xticks positions.

Source

pub fn yformat(&mut self, format: TickFormat)

Label presentation for explicit Axes::yticks positions.

Source

pub fn scatter(&mut self, x: &[f32], y: &[f32], style: ScatterStyle)

Point cloud scatter.

Source

pub fn bar(&mut self, y: &[f32], style: BarStyle)

Vertical bar chart at x = 0..n-1.

Source

pub fn bar_grouped(&mut self, series: &[&[f32]], styles: &[BarStyle])

Grouped bar chart — series[i] shares each x slot side-by-side.

styles pairs per layer; a short list falls back to defaults (palette colors). Each layer is its own artist, so legend rows and visibility toggling work per series.

Source

pub fn bar_stacked(&mut self, series: &[&[f32]], styles: &[BarStyle])

Stacked bar chart — series[i] accumulates on top of the layers before it.

Style and artist semantics match Axes::bar_grouped; each layer’s baseline is the running sum of the previous layers’ values.

Source

pub fn stream(&mut self, capacity: usize, style: LineStyle) -> usize

Begin a rolling line series of fixed capacity samples.

Returns the series handle for Axes::stream_push. The window’s x domain is the sample indices 0..capacity-1, so the trace fills from the left and then scrolls as the oldest samples drop.

Source

pub fn stream_push(&mut self, series: usize, values: &[f32])

Append samples to a Axes::stream series.

Out-of-range handles are ignored, matching the silent-skip contract of the other recording methods.

Source

pub fn band(&mut self, y_lo: &[f32], y_hi: &[f32], style: LineStyle)

Fill the band between two equal-length y curves at x = 0..n-1.

The error-band / fill_between primitive: style.color (alpha included) tints the shaded region. Band x positions are the sample indices, so a non-linear x axis is rejected at replay.

Source

pub fn boxplot(&mut self, datasets: &[&[f32]], style: BoxStyle)

Box-and-whisker summary over one or more datasets.

Each dataset becomes one box centered on its own x slot, palette-colored in order. Quartiles use linear interpolation (matplotlib default) and whiskers extend style.whisk × IQR, clamped to the data extremes.

Source

pub fn histogram(&mut self, values: &[f32], bins: i32, style: BarStyle)

Histogram: bin values into bins bars.

Source

pub fn limits(&mut self, x_min: f32, x_max: f32, y_min: f32, y_max: f32)

Fixed data limits; degenerate input restores auto-limits.

Source

pub fn auto_limits(&mut self)

Restore automatic data-driven limits.

Source

pub fn grid(&mut self, visible: bool)

Toggle the background grid (default: on).

Source

pub fn legend(&mut self, visible: bool)

Toggle the labeled-series legend (default: on).

Source

pub fn border_color(&mut self, color: Color)

Border color around the axes rect (default: none).

Source

pub fn clear(&mut self)

Clear all recorded commands.

Source

pub fn artist_count(&self) -> usize

Number of recorded artists in insertion order.

Source

pub fn artist_hidden(&self, index: usize) -> Option<bool>

Visibility flag of the index-th artist in insertion order.

Source

pub fn set_artist_hidden(&mut self, index: usize, hidden: bool)

Show or hide the index-th artist in insertion order.

Hidden artists keep their palette slot and legend entry but skip rendering; FigureView legend toggling writes this flag.

Source

pub fn set_series_highlight(&mut self, index: Option<usize>)

Highlight the index-th artist in insertion order, dimming the rest.

None restores uniform emphasis; FigureView legend hover writes this.

Source

pub fn data_limits(&self) -> [f32; 4]

Effective data limits [x_min, x_max, y_min, y_max] after explicit limits or automatic data-driven resolution. Interactive views use this to map pixel coordinates into data space.

Source

pub fn explicit_limits(&self) -> Option<[f32; 4]>

The explicit limits override, or None when limits are data-driven.

Trait Implementations§

Source§

impl Clone for Axes

Source§

fn clone(&self) -> Self

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 Axes

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl !RefUnwindSafe for Axes

§

impl !Send for Axes

§

impl !Sync for Axes

§

impl !UnwindSafe for Axes

§

impl Forget for Axes

§

impl Freeze for Axes
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze, *const RcInner<RefCell<RuntimeState>> is !null: Freeze, PhantomData<RcInner<RefCell<RuntimeState>>>: Freeze, *const RcInner<StorageInner> is !null: Freeze, PhantomData<RcInner<StorageInner>>: Freeze, PhantomData<usize>: Freeze, *const RcInner<MatrixSemantic> is !null: Freeze, PhantomData<RcInner<MatrixSemantic>>: Freeze, PhantomData<Rc<()>>: Freeze, *const RcInner<NativeRgbaImage> is !null: Freeze, PhantomData<RcInner<NativeRgbaImage>>: Freeze, *const RcInner<RefCell<RendererState>> is !null: Freeze, PhantomData<RcInner<RefCell<RendererState>>>: Freeze, *const RcInner<TextureSemantic> is !null: Freeze, PhantomData<RcInner<TextureSemantic>>: Freeze, PhantomData<f32>: Freeze, PhantomData<LineCmd>: Freeze, PhantomData<ScatterCmd>: Freeze, PhantomData<BarCmd>: Freeze, PhantomData<LineMatrixCmd>: Freeze, PhantomData<StreamCmd>: Freeze, PhantomData<BandCmd>: Freeze, PhantomData<BoxCmd>: Freeze, PhantomData<AnnotationCmd>: Freeze, PhantomData<ArtistKind>: Freeze, PhantomData<String>: Freeze,

§

impl Move for Axes

§

impl Unpin for Axes
where *const u8 is !null: Unpin, Rc<RefCell<RuntimeState>>: Unpin, Rc<StorageInner>: Unpin, Rc<MatrixSemantic>: Unpin, Rc<()>: Unpin, Rc<NativeRgbaImage>: Unpin, Rc<RefCell<RendererState>>: Unpin, Rc<TextureSemantic>: Unpin,

§

impl UnsafeUnpin for Axes
where *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, *const RcInner<RefCell<RuntimeState>> is !null: UnsafeUnpin, PhantomData<RcInner<RefCell<RuntimeState>>>: UnsafeUnpin, *const RcInner<StorageInner> is !null: UnsafeUnpin, PhantomData<RcInner<StorageInner>>: UnsafeUnpin, PhantomData<usize>: UnsafeUnpin, *const RcInner<MatrixSemantic> is !null: UnsafeUnpin, PhantomData<RcInner<MatrixSemantic>>: UnsafeUnpin, PhantomData<Rc<()>>: UnsafeUnpin, *const RcInner<NativeRgbaImage> is !null: UnsafeUnpin, PhantomData<RcInner<NativeRgbaImage>>: UnsafeUnpin, *const RcInner<RefCell<RendererState>> is !null: UnsafeUnpin, PhantomData<RcInner<RefCell<RendererState>>>: UnsafeUnpin, *const RcInner<TextureSemantic> is !null: UnsafeUnpin, PhantomData<RcInner<TextureSemantic>>: UnsafeUnpin, PhantomData<f32>: UnsafeUnpin, PhantomData<LineCmd>: UnsafeUnpin, PhantomData<ScatterCmd>: UnsafeUnpin, PhantomData<BarCmd>: UnsafeUnpin, PhantomData<LineMatrixCmd>: UnsafeUnpin, PhantomData<StreamCmd>: UnsafeUnpin, PhantomData<BandCmd>: UnsafeUnpin, PhantomData<BoxCmd>: UnsafeUnpin, PhantomData<AnnotationCmd>: UnsafeUnpin, PhantomData<ArtistKind>: UnsafeUnpin, PhantomData<String>: UnsafeUnpin,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.