PlotUi

Struct PlotUi 

Source
pub struct PlotUi<'ui> { /* private fields */ }
Expand description

A temporary reference for building plots

This struct ensures that plots can only be created when both ImGui and ImPlot contexts are available and properly set up.

Implementations§

Source§

impl<'ui> PlotUi<'ui>

Source

pub fn begin_plot(&self, title: &str) -> Option<PlotToken<'_>>

Begin a new plot with the given title

Returns a PlotToken if the plot was successfully started. The plot will be automatically ended when the token is dropped.

Source

pub fn begin_plot_with_size( &self, title: &str, size: [f32; 2], ) -> Option<PlotToken<'_>>

Begin a plot with custom size

Source

pub fn plot_line(&self, label: &str, x_data: &[f64], y_data: &[f64])

Plot a line with the given label and data

This is a convenience method that can be called within a plot.

Source

pub fn plot_scatter(&self, label: &str, x_data: &[f64], y_data: &[f64])

Plot a scatter plot with the given label and data

Source

pub fn is_plot_hovered(&self) -> bool

Check if the plot area is hovered

Source

pub fn get_plot_mouse_pos(&self, y_axis: Option<YAxisChoice>) -> ImPlotPoint

Get the mouse position in plot coordinates

Source

pub fn get_plot_mouse_pos_axes( &self, x_axis: XAxis, y_axis: YAxis, ) -> ImPlotPoint

Get the mouse position in plot coordinates for specific axes

Source

pub fn set_axes(&self, x_axis: XAxis, y_axis: YAxis)

Set current axes for subsequent plot submissions

Source

pub fn setup_x_axis(&self, axis: XAxis, label: Option<&str>, flags: AxisFlags)

Setup a specific X axis

Source

pub fn setup_y_axis(&self, axis: YAxis, label: Option<&str>, flags: AxisFlags)

Setup a specific Y axis

Source

pub fn setup_x_axis_limits( &self, axis: XAxis, min: f64, max: f64, cond: PlotCond, )

Setup axis limits for a specific X axis

Source

pub fn setup_y_axis_limits( &self, axis: YAxis, min: f64, max: f64, cond: PlotCond, )

Setup axis limits for a specific Y axis

Link an axis to external min/max values (live binding)

Source

pub fn setup_axes( &self, x_label: Option<&str>, y_label: Option<&str>, x_flags: AxisFlags, y_flags: AxisFlags, )

Setup both axes labels/flags at once

Source

pub fn setup_axes_limits( &self, x_min: f64, x_max: f64, y_min: f64, y_max: f64, cond: PlotCond, )

Setup axes limits (both) at once

Source

pub fn setup_finish(&self)

Call after axis setup to finalize configuration

Source

pub fn set_next_x_axis_limits( &self, axis: XAxis, min: f64, max: f64, cond: PlotCond, )

Set next frame limits for a specific axis

Source

pub fn set_next_y_axis_limits( &self, axis: YAxis, min: f64, max: f64, cond: PlotCond, )

Set next frame limits for a specific axis

Link an axis to external min/max for next frame

Source

pub fn set_next_axes_limits( &self, x_min: f64, x_max: f64, y_min: f64, y_max: f64, cond: PlotCond, )

Set next frame limits for both axes

Source

pub fn set_next_axes_to_fit(&self)

Fit next frame both axes

Source

pub fn set_next_axis_to_fit(&self, axis: i32)

Fit next frame a specific axis (raw)

Source

pub fn set_next_x_axis_to_fit(&self, axis: XAxis)

Fit next frame a specific X axis

Source

pub fn set_next_y_axis_to_fit(&self, axis: YAxis)

Fit next frame a specific Y axis

Source

pub fn setup_x_axis_ticks_positions( &self, axis: XAxis, values: &[f64], labels: Option<&[&str]>, keep_default: bool, )

Setup ticks with explicit positions and optional labels for an X axis

Source

pub fn setup_y_axis_ticks_positions( &self, axis: YAxis, values: &[f64], labels: Option<&[&str]>, keep_default: bool, )

Setup ticks with explicit positions and optional labels for a Y axis

Source

pub fn setup_x_axis_ticks_range( &self, axis: XAxis, v_min: f64, v_max: f64, n_ticks: i32, labels: Option<&[&str]>, keep_default: bool, )

Setup ticks on a range with tick count and optional labels for an X axis

Source

pub fn setup_y_axis_ticks_range( &self, axis: YAxis, v_min: f64, v_max: f64, n_ticks: i32, labels: Option<&[&str]>, keep_default: bool, )

Setup ticks on a range with tick count and optional labels for a Y axis

Source

pub fn setup_x_axis_format(&self, axis: XAxis, fmt: &str)

Setup tick label format string for a specific X axis

Source

pub fn setup_y_axis_format(&self, axis: YAxis, fmt: &str)

Setup tick label format string for a specific Y axis

Source

pub fn setup_x_axis_scale(&self, axis: XAxis, scale: ImPlotScale)

Setup scale for a specific X axis (pass sys::ImPlotScale variant)

Source

pub fn setup_y_axis_scale(&self, axis: YAxis, scale: ImPlotScale)

Setup scale for a specific Y axis (pass sys::ImPlotScale variant)

Source

pub fn setup_axis_limits_constraints(&self, axis: i32, v_min: f64, v_max: f64)

Setup axis limits constraints

Source

pub fn setup_axis_zoom_constraints(&self, axis: i32, z_min: f64, z_max: f64)

Setup axis zoom constraints

Source

pub fn setup_x_axis_format_closure<F>( &self, axis: XAxis, f: F, ) -> AxisFormatterToken
where F: Fn(f64) -> String + Send + Sync + 'static,

Setup tick label formatter using a Rust closure (lives until token drop)

Source

pub fn setup_y_axis_format_closure<F>( &self, axis: YAxis, f: F, ) -> AxisFormatterToken
where F: Fn(f64) -> String + Send + Sync + 'static,

Setup tick label formatter using a Rust closure (lives until token drop)

Source

pub fn setup_x_axis_transform_closure<FW, INV>( &self, axis: XAxis, forward: FW, inverse: INV, ) -> AxisTransformToken
where FW: Fn(f64) -> f64 + Send + Sync + 'static, INV: Fn(f64) -> f64 + Send + Sync + 'static,

Setup custom axis transform using Rust closures (forward/inverse) valid until token drop

Source

pub fn setup_y_axis_transform_closure<FW, INV>( &self, axis: YAxis, forward: FW, inverse: INV, ) -> AxisTransformToken
where FW: Fn(f64) -> f64 + Send + Sync + 'static, INV: Fn(f64) -> f64 + Send + Sync + 'static,

Setup custom axis transform for Y axis using closures

Source§

impl<'ui> PlotUi<'ui>

Convenience functions for quick bar plotting

Source

pub fn bar_plot(&self, label: &str, values: &[f64]) -> Result<(), PlotError>

Plot a bar chart with values (X will be indices)

Source

pub fn bar_plot_with_width( &self, label: &str, values: &[f64], width: f64, ) -> Result<(), PlotError>

Plot a bar chart with custom bar width

Source

pub fn positional_bar_plot( &self, label: &str, x_data: &[f64], y_data: &[f64], ) -> Result<(), PlotError>

Plot a positional bar chart with explicit X and Y data

Source§

impl<'ui> PlotUi<'ui>

Convenience functions for quick error bars plotting

Source

pub fn error_bars_plot( &self, label: &str, x_data: &[f64], y_data: &[f64], err_data: &[f64], ) -> Result<(), PlotError>

Plot error bars with symmetric errors

Source

pub fn asymmetric_error_bars_plot( &self, label: &str, x_data: &[f64], y_data: &[f64], err_neg: &[f64], err_pos: &[f64], ) -> Result<(), PlotError>

Plot error bars with asymmetric errors

Source

pub fn simple_error_bars_plot( &self, label: &str, values: &[f64], errors: &[f64], ) -> Result<(), PlotError>

Plot simple error bars with Y values only (X will be indices)

Source§

impl<'ui> PlotUi<'ui>

Convenience functions for quick heatmap plotting

Source

pub fn heatmap_plot( &self, label: &str, values: &[f64], rows: usize, cols: usize, ) -> Result<(), PlotError>

Plot a heatmap with f64 data

Source

pub fn heatmap_plot_f32( &self, label: &str, values: &[f32], rows: usize, cols: usize, ) -> Result<(), PlotError>

Plot a heatmap with f32 data

Source

pub fn heatmap_plot_scaled( &self, label: &str, values: &[f64], rows: usize, cols: usize, scale_min: f64, scale_max: f64, bounds_min: ImPlotPoint, bounds_max: ImPlotPoint, ) -> Result<(), PlotError>

Plot a heatmap with custom scale and bounds

Source§

impl<'ui> PlotUi<'ui>

Convenience functions for quick histogram plotting

Source

pub fn histogram_plot( &self, label: &str, values: &[f64], ) -> Result<(), PlotError>

Plot a 1D histogram with default settings

Source

pub fn histogram_plot_with_bins( &self, label: &str, values: &[f64], bins: i32, ) -> Result<(), PlotError>

Plot a 1D histogram with custom bin count

Source

pub fn histogram_2d_plot( &self, label: &str, x_values: &[f64], y_values: &[f64], ) -> Result<(), PlotError>

Plot a 2D histogram (bivariate histogram as heatmap)

Source

pub fn histogram_2d_plot_with_bins( &self, label: &str, x_values: &[f64], y_values: &[f64], x_bins: i32, y_bins: i32, ) -> Result<(), PlotError>

Plot a 2D histogram with custom bin counts

Source§

impl<'ui> PlotUi<'ui>

Convenience methods on PlotUi

Source

pub fn plot_image( &self, label: &str, tex_id: ImTextureID, bounds_min: ImPlotPoint, bounds_max: ImPlotPoint, ) -> Result<(), PlotError>

Source

pub fn plot_image_with_imgui_texture( &self, label: &str, texture: TextureId, bounds_min: ImPlotPoint, bounds_max: ImPlotPoint, ) -> Result<(), PlotError>

Plot an image using ImGui’s TextureId wrapper (if available)

Source§

impl<'ui> PlotUi<'ui>

Convenience functions for quick inf-lines plotting

Source

pub fn inf_lines_vertical( &self, label: &str, xs: &[f64], ) -> Result<(), PlotError>

Plot vertical infinite lines at given x positions

Source

pub fn inf_lines_horizontal( &self, label: &str, ys: &[f64], ) -> Result<(), PlotError>

Plot horizontal infinite lines at given y positions

Source§

impl<'ui> PlotUi<'ui>

Convenience functions for quick line plotting

Source

pub fn line_plot( &self, label: &str, x_data: &[f64], y_data: &[f64], ) -> Result<(), PlotError>

Plot a line with X and Y data

Source

pub fn simple_line_plot( &self, label: &str, values: &[f64], ) -> Result<(), PlotError>

Plot a simple line with Y values only (X will be indices)

Source§

impl<'ui> PlotUi<'ui>

Convenience functions for quick pie chart plotting

Source

pub fn pie_chart_plot( &self, label_ids: Vec<&str>, values: &[f64], center_x: f64, center_y: f64, radius: f64, ) -> Result<(), PlotError>

Plot a pie chart with f64 data

Source

pub fn pie_chart_plot_f32( &self, label_ids: Vec<&str>, values: &[f32], center_x: f64, center_y: f64, radius: f64, ) -> Result<(), PlotError>

Plot a pie chart with f32 data

Source

pub fn centered_pie_chart( &self, label_ids: Vec<&str>, values: &[f64], ) -> Result<(), PlotError>

Plot a centered pie chart (center at 0.5, 0.5 with radius 0.4)

Source§

impl<'ui> PlotUi<'ui>

Convenience functions for quick scatter plotting

Source

pub fn scatter_plot( &self, label: &str, x_data: &[f64], y_data: &[f64], ) -> Result<(), PlotError>

Plot a scatter plot with X and Y data

Source

pub fn simple_scatter_plot( &self, label: &str, values: &[f64], ) -> Result<(), PlotError>

Plot a simple scatter plot with Y values only (X will be indices)

Source§

impl<'ui> PlotUi<'ui>

Convenience functions for quick shaded plotting

Source

pub fn shaded_plot( &self, label: &str, x_data: &[f64], y_data: &[f64], ) -> Result<(), PlotError>

Plot a shaded area between a line and Y=0

Source

pub fn shaded_plot_with_ref( &self, label: &str, x_data: &[f64], y_data: &[f64], y_ref: f64, ) -> Result<(), PlotError>

Plot a shaded area between a line and a reference Y value

Source

pub fn shaded_between_plot( &self, label: &str, x_data: &[f64], y1_data: &[f64], y2_data: &[f64], ) -> Result<(), PlotError>

Plot a shaded area between two lines

Source

pub fn simple_shaded_plot( &self, label: &str, values: &[f64], ) -> Result<(), PlotError>

Plot a simple shaded area with Y values only (X will be indices)

Source§

impl<'ui> PlotUi<'ui>

Convenience functions for quick stem plotting

Source

pub fn stem_plot( &self, label: &str, x_data: &[f64], y_data: &[f64], ) -> Result<(), PlotError>

Plot a stem plot with X and Y data

Source

pub fn stem_plot_with_ref( &self, label: &str, x_data: &[f64], y_data: &[f64], y_ref: f64, ) -> Result<(), PlotError>

Plot a stem plot with custom reference Y value

Source

pub fn simple_stem_plot( &self, label: &str, values: &[f64], ) -> Result<(), PlotError>

Plot a simple stem plot with Y values only (X will be indices)

Source

pub fn simple_stem_plot_with_ref( &self, label: &str, values: &[f64], y_ref: f64, ) -> Result<(), PlotError>

Plot a simple stem plot with custom reference Y value

Auto Trait Implementations§

§

impl<'ui> Freeze for PlotUi<'ui>

§

impl<'ui> !RefUnwindSafe for PlotUi<'ui>

§

impl<'ui> !Send for PlotUi<'ui>

§

impl<'ui> !Sync for PlotUi<'ui>

§

impl<'ui> Unpin for PlotUi<'ui>

§

impl<'ui> !UnwindSafe for PlotUi<'ui>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more