pub struct Axes { /* private fields */ }Expand description
One subplot inside an oa::plot::Figure.
Implementations§
Source§impl Axes
impl Axes
Sourcepub fn title(&mut self, text: &str)
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.
Sourcepub fn title_color(&mut self, text: &str, color: Color)
pub fn title_color(&mut self, text: &str, color: Color)
Set the axes title with an explicit text color.
Sourcepub fn caption(&mut self, text: &str)
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.
Sourcepub fn caption_color(&mut self, text: &str, color: Color)
pub fn caption_color(&mut self, text: &str, color: Color)
Set caption with an explicit text color.
Sourcepub fn x_label(&mut self, text: &str)
pub fn x_label(&mut self, text: &str)
Set the horizontal axis label centered below the tick labels.
Sourcepub fn y_label(&mut self, text: &str)
pub fn y_label(&mut self, text: &str)
Set the vertical axis label, read bottom-to-top to the left of the ticks.
Sourcepub fn imshow(&mut self, texture: Texture)
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.
Sourcepub fn heatmap(
&mut self,
values: &[f32],
rows: i32,
cols: i32,
style: HeatmapStyle,
)
pub fn heatmap( &mut self, values: &[f32], rows: i32, cols: i32, style: HeatmapStyle, )
Dense row-major heatmap. Donor: oa::plot::Axes::heatmap.
Sourcepub fn heatmap_matrix(&mut self, values: Matrix, style: HeatmapStyle)
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.
Sourcepub fn plot(&mut self, y: &[f32], style: LineStyle)
pub fn plot(&mut self, y: &[f32], style: LineStyle)
Line plot: y-values vs index. Repeated calls append ordered series.
Sourcepub fn plot_matrix(&mut self, values: &Matrix, style: LineStyle)
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.
Sourcepub fn plot_matrix_y(&mut self, values: &Matrix, style: LineStyle)
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.
Sourcepub fn annotate(&mut self, text: &str, x: f32, y: f32)
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.
Sourcepub fn categories(&mut self, labels: &[&str])
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.
Sourcepub fn xticks(&mut self, values: &[f32])
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.
Sourcepub fn yticks(&mut self, values: &[f32])
pub fn yticks(&mut self, values: &[f32])
Explicit y tick positions in data space; see Axes::xticks.
Sourcepub fn xformat(&mut self, format: TickFormat)
pub fn xformat(&mut self, format: TickFormat)
Label presentation for explicit Axes::xticks positions.
Sourcepub fn yformat(&mut self, format: TickFormat)
pub fn yformat(&mut self, format: TickFormat)
Label presentation for explicit Axes::yticks positions.
Sourcepub fn scatter(&mut self, x: &[f32], y: &[f32], style: ScatterStyle)
pub fn scatter(&mut self, x: &[f32], y: &[f32], style: ScatterStyle)
Point cloud scatter.
Sourcepub fn bar_grouped(&mut self, series: &[&[f32]], styles: &[BarStyle])
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.
Sourcepub fn bar_stacked(&mut self, series: &[&[f32]], styles: &[BarStyle])
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.
Sourcepub fn stream(&mut self, capacity: usize, style: LineStyle) -> usize
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.
Sourcepub fn stream_push(&mut self, series: usize, values: &[f32])
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.
Sourcepub fn band(&mut self, y_lo: &[f32], y_hi: &[f32], style: LineStyle)
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.
Sourcepub fn boxplot(&mut self, datasets: &[&[f32]], style: BoxStyle)
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.
Sourcepub fn histogram(&mut self, values: &[f32], bins: i32, style: BarStyle)
pub fn histogram(&mut self, values: &[f32], bins: i32, style: BarStyle)
Histogram: bin values into bins bars.
Sourcepub fn limits(&mut self, x_min: f32, x_max: f32, y_min: f32, y_max: f32)
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.
Sourcepub fn auto_limits(&mut self)
pub fn auto_limits(&mut self)
Restore automatic data-driven limits.
Sourcepub fn border_color(&mut self, color: Color)
pub fn border_color(&mut self, color: Color)
Border color around the axes rect (default: none).
Sourcepub fn artist_count(&self) -> usize
pub fn artist_count(&self) -> usize
Number of recorded artists in insertion order.
Visibility flag of the index-th artist in insertion order.
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.
Sourcepub fn set_series_highlight(&mut self, index: Option<usize>)
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.
Sourcepub fn data_limits(&self) -> [f32; 4]
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.
Sourcepub fn explicit_limits(&self) -> Option<[f32; 4]>
pub fn explicit_limits(&self) -> Option<[f32; 4]>
The explicit limits override, or None when limits are data-driven.