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>
impl<'ui> PlotUi<'ui>
Sourcepub fn begin_plot(&self, title: &str) -> Option<PlotToken<'_>>
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.
Sourcepub fn begin_plot_with_size(
&self,
title: &str,
size: [f32; 2],
) -> Option<PlotToken<'_>>
pub fn begin_plot_with_size( &self, title: &str, size: [f32; 2], ) -> Option<PlotToken<'_>>
Begin a plot with custom size
Sourcepub fn plot_line(&self, label: &str, x_data: &[f64], y_data: &[f64])
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.
Sourcepub fn plot_scatter(&self, label: &str, x_data: &[f64], y_data: &[f64])
pub fn plot_scatter(&self, label: &str, x_data: &[f64], y_data: &[f64])
Plot a scatter plot with the given label and data
Sourcepub fn is_plot_hovered(&self) -> bool
pub fn is_plot_hovered(&self) -> bool
Check if the plot area is hovered
Sourcepub fn get_plot_mouse_pos(&self, y_axis: Option<YAxisChoice>) -> ImPlotPoint
pub fn get_plot_mouse_pos(&self, y_axis: Option<YAxisChoice>) -> ImPlotPoint
Get the mouse position in plot coordinates
Sourcepub fn get_plot_mouse_pos_axes(
&self,
x_axis: XAxis,
y_axis: YAxis,
) -> ImPlotPoint
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
Sourcepub fn set_axes(&self, x_axis: XAxis, y_axis: YAxis)
pub fn set_axes(&self, x_axis: XAxis, y_axis: YAxis)
Set current axes for subsequent plot submissions
Sourcepub fn setup_x_axis(&self, axis: XAxis, label: Option<&str>, flags: AxisFlags)
pub fn setup_x_axis(&self, axis: XAxis, label: Option<&str>, flags: AxisFlags)
Setup a specific X axis
Sourcepub fn setup_y_axis(&self, axis: YAxis, label: Option<&str>, flags: AxisFlags)
pub fn setup_y_axis(&self, axis: YAxis, label: Option<&str>, flags: AxisFlags)
Setup a specific Y axis
Sourcepub fn setup_x_axis_limits(
&self,
axis: XAxis,
min: f64,
max: f64,
cond: PlotCond,
)
pub fn setup_x_axis_limits( &self, axis: XAxis, min: f64, max: f64, cond: PlotCond, )
Setup axis limits for a specific X axis
Sourcepub fn setup_y_axis_limits(
&self,
axis: YAxis,
min: f64,
max: f64,
cond: PlotCond,
)
pub fn setup_y_axis_limits( &self, axis: YAxis, min: f64, max: f64, cond: PlotCond, )
Setup axis limits for a specific Y axis
Sourcepub fn setup_axis_links(
&self,
axis: i32,
link_min: Option<&mut f64>,
link_max: Option<&mut f64>,
)
pub fn setup_axis_links( &self, axis: i32, link_min: Option<&mut f64>, link_max: Option<&mut f64>, )
Link an axis to external min/max values (live binding)
Sourcepub fn setup_axes(
&self,
x_label: Option<&str>,
y_label: Option<&str>,
x_flags: AxisFlags,
y_flags: AxisFlags,
)
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
Sourcepub fn setup_axes_limits(
&self,
x_min: f64,
x_max: f64,
y_min: f64,
y_max: f64,
cond: PlotCond,
)
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
Sourcepub fn setup_finish(&self)
pub fn setup_finish(&self)
Call after axis setup to finalize configuration
Sourcepub fn set_next_x_axis_limits(
&self,
axis: XAxis,
min: f64,
max: f64,
cond: PlotCond,
)
pub fn set_next_x_axis_limits( &self, axis: XAxis, min: f64, max: f64, cond: PlotCond, )
Set next frame limits for a specific axis
Sourcepub fn set_next_y_axis_limits(
&self,
axis: YAxis,
min: f64,
max: f64,
cond: PlotCond,
)
pub fn set_next_y_axis_limits( &self, axis: YAxis, min: f64, max: f64, cond: PlotCond, )
Set next frame limits for a specific axis
Sourcepub fn set_next_axis_links(
&self,
axis: i32,
link_min: Option<&mut f64>,
link_max: Option<&mut f64>,
)
pub fn set_next_axis_links( &self, axis: i32, link_min: Option<&mut f64>, link_max: Option<&mut f64>, )
Link an axis to external min/max for next frame
Sourcepub fn set_next_axes_limits(
&self,
x_min: f64,
x_max: f64,
y_min: f64,
y_max: f64,
cond: PlotCond,
)
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
Sourcepub fn set_next_axes_to_fit(&self)
pub fn set_next_axes_to_fit(&self)
Fit next frame both axes
Sourcepub fn set_next_axis_to_fit(&self, axis: i32)
pub fn set_next_axis_to_fit(&self, axis: i32)
Fit next frame a specific axis (raw)
Sourcepub fn set_next_x_axis_to_fit(&self, axis: XAxis)
pub fn set_next_x_axis_to_fit(&self, axis: XAxis)
Fit next frame a specific X axis
Sourcepub fn set_next_y_axis_to_fit(&self, axis: YAxis)
pub fn set_next_y_axis_to_fit(&self, axis: YAxis)
Fit next frame a specific Y axis
Sourcepub fn setup_x_axis_ticks_positions(
&self,
axis: XAxis,
values: &[f64],
labels: Option<&[&str]>,
keep_default: bool,
)
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
Sourcepub fn setup_y_axis_ticks_positions(
&self,
axis: YAxis,
values: &[f64],
labels: Option<&[&str]>,
keep_default: bool,
)
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
Sourcepub fn setup_x_axis_ticks_range(
&self,
axis: XAxis,
v_min: f64,
v_max: f64,
n_ticks: i32,
labels: Option<&[&str]>,
keep_default: bool,
)
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
Sourcepub fn setup_y_axis_ticks_range(
&self,
axis: YAxis,
v_min: f64,
v_max: f64,
n_ticks: i32,
labels: Option<&[&str]>,
keep_default: bool,
)
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
Sourcepub fn setup_x_axis_format(&self, axis: XAxis, fmt: &str)
pub fn setup_x_axis_format(&self, axis: XAxis, fmt: &str)
Setup tick label format string for a specific X axis
Sourcepub fn setup_y_axis_format(&self, axis: YAxis, fmt: &str)
pub fn setup_y_axis_format(&self, axis: YAxis, fmt: &str)
Setup tick label format string for a specific Y axis
Sourcepub fn setup_x_axis_scale(&self, axis: XAxis, scale: ImPlotScale)
pub fn setup_x_axis_scale(&self, axis: XAxis, scale: ImPlotScale)
Setup scale for a specific X axis (pass sys::ImPlotScale variant)
Sourcepub fn setup_y_axis_scale(&self, axis: YAxis, scale: ImPlotScale)
pub fn setup_y_axis_scale(&self, axis: YAxis, scale: ImPlotScale)
Setup scale for a specific Y axis (pass sys::ImPlotScale variant)
Sourcepub fn setup_axis_limits_constraints(&self, axis: i32, v_min: f64, v_max: f64)
pub fn setup_axis_limits_constraints(&self, axis: i32, v_min: f64, v_max: f64)
Setup axis limits constraints
Sourcepub fn setup_axis_zoom_constraints(&self, axis: i32, z_min: f64, z_max: f64)
pub fn setup_axis_zoom_constraints(&self, axis: i32, z_min: f64, z_max: f64)
Setup axis zoom constraints
Sourcepub fn setup_x_axis_format_closure<F>(
&self,
axis: XAxis,
f: F,
) -> AxisFormatterToken
pub fn setup_x_axis_format_closure<F>( &self, axis: XAxis, f: F, ) -> AxisFormatterToken
Setup tick label formatter using a Rust closure (lives until token drop)
Sourcepub fn setup_y_axis_format_closure<F>(
&self,
axis: YAxis,
f: F,
) -> AxisFormatterToken
pub fn setup_y_axis_format_closure<F>( &self, axis: YAxis, f: F, ) -> AxisFormatterToken
Setup tick label formatter using a Rust closure (lives until token drop)
Sourcepub fn setup_x_axis_transform_closure<FW, INV>(
&self,
axis: XAxis,
forward: FW,
inverse: INV,
) -> AxisTransformToken
pub fn setup_x_axis_transform_closure<FW, INV>( &self, axis: XAxis, forward: FW, inverse: INV, ) -> AxisTransformToken
Setup custom axis transform using Rust closures (forward/inverse) valid until token drop
Source§impl<'ui> PlotUi<'ui>
Convenience functions for quick bar plotting
impl<'ui> PlotUi<'ui>
Convenience functions for quick bar plotting
Source§impl<'ui> PlotUi<'ui>
Convenience functions for quick error bars plotting
impl<'ui> PlotUi<'ui>
Convenience functions for quick error bars plotting
Sourcepub fn error_bars_plot(
&self,
label: &str,
x_data: &[f64],
y_data: &[f64],
err_data: &[f64],
) -> Result<(), PlotError>
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§impl<'ui> PlotUi<'ui>
Convenience functions for quick heatmap plotting
impl<'ui> PlotUi<'ui>
Convenience functions for quick heatmap plotting
Sourcepub fn heatmap_plot(
&self,
label: &str,
values: &[f64],
rows: usize,
cols: usize,
) -> Result<(), PlotError>
pub fn heatmap_plot( &self, label: &str, values: &[f64], rows: usize, cols: usize, ) -> Result<(), PlotError>
Plot a heatmap with f64 data
Sourcepub fn heatmap_plot_f32(
&self,
label: &str,
values: &[f32],
rows: usize,
cols: usize,
) -> Result<(), PlotError>
pub fn heatmap_plot_f32( &self, label: &str, values: &[f32], rows: usize, cols: usize, ) -> Result<(), PlotError>
Plot a heatmap with f32 data
Sourcepub 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>
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
impl<'ui> PlotUi<'ui>
Convenience functions for quick histogram plotting
Sourcepub fn histogram_plot(
&self,
label: &str,
values: &[f64],
) -> Result<(), PlotError>
pub fn histogram_plot( &self, label: &str, values: &[f64], ) -> Result<(), PlotError>
Plot a 1D histogram with default settings
Sourcepub fn histogram_plot_with_bins(
&self,
label: &str,
values: &[f64],
bins: i32,
) -> Result<(), PlotError>
pub fn histogram_plot_with_bins( &self, label: &str, values: &[f64], bins: i32, ) -> Result<(), PlotError>
Plot a 1D histogram with custom bin count
Source§impl<'ui> PlotUi<'ui>
Convenience methods on PlotUi
impl<'ui> PlotUi<'ui>
Convenience methods on PlotUi
pub fn plot_image( &self, label: &str, tex_id: ImTextureID, bounds_min: ImPlotPoint, bounds_max: ImPlotPoint, ) -> Result<(), PlotError>
Sourcepub fn plot_image_with_imgui_texture(
&self,
label: &str,
texture: TextureId,
bounds_min: ImPlotPoint,
bounds_max: ImPlotPoint,
) -> Result<(), PlotError>
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 pie chart plotting
impl<'ui> PlotUi<'ui>
Convenience functions for quick pie chart plotting
Sourcepub fn pie_chart_plot(
&self,
label_ids: Vec<&str>,
values: &[f64],
center_x: f64,
center_y: f64,
radius: f64,
) -> Result<(), PlotError>
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§impl<'ui> PlotUi<'ui>
Convenience functions for quick scatter plotting
impl<'ui> PlotUi<'ui>
Convenience functions for quick scatter plotting
Source§impl<'ui> PlotUi<'ui>
Convenience functions for quick shaded plotting
impl<'ui> PlotUi<'ui>
Convenience functions for quick shaded plotting
Sourcepub fn shaded_plot(
&self,
label: &str,
x_data: &[f64],
y_data: &[f64],
) -> Result<(), PlotError>
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
Sourcepub fn shaded_plot_with_ref(
&self,
label: &str,
x_data: &[f64],
y_data: &[f64],
y_ref: f64,
) -> Result<(), PlotError>
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§impl<'ui> PlotUi<'ui>
Convenience functions for quick stem plotting
impl<'ui> PlotUi<'ui>
Convenience functions for quick stem plotting
Sourcepub fn stem_plot(
&self,
label: &str,
x_data: &[f64],
y_data: &[f64],
) -> Result<(), PlotError>
pub fn stem_plot( &self, label: &str, x_data: &[f64], y_data: &[f64], ) -> Result<(), PlotError>
Plot a stem plot with X and Y data
Sourcepub fn stem_plot_with_ref(
&self,
label: &str,
x_data: &[f64],
y_data: &[f64],
y_ref: f64,
) -> Result<(), PlotError>
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