Expand description
§Dear ImPlot - Rust Bindings with Dear ImGui Compatibility
High-level Rust bindings for ImPlot, the immediate mode plotting library. This crate provides safe, idiomatic Rust bindings designed to work seamlessly with dear-imgui (C++ bindgen) rather than imgui-rs (cimgui).
§Features
- Safe, idiomatic Rust API
- Full compatibility with dear-imgui
- Builder pattern for plots and plot elements
- Memory-safe string handling
- Support for all major plot types
§Quick Start
use dear_imgui_rs::*;
use dear_implot::*;
let mut ctx = Context::create();
let mut plot_ctx = PlotContext::create(&ctx);
let ui = ctx.frame();
let plot_ui = plot_ctx.get_plot_ui(&ui);
if let Some(token) = plot_ui.begin_plot("My Plot") {
plot_ui.plot_line("Line", &[1.0, 2.0, 3.0, 4.0], &[1.0, 4.0, 2.0, 3.0]);
token.end();
}§Integration with Dear ImGui
This crate is designed to work with the dear-imgui-rs ecosystem:
- Uses the same context management patterns
- Compatible with dear-imgui’s UI tokens and lifetime management
- Shares the same underlying Dear ImGui context
Re-exports§
pub use plots::Plot;pub use plots::PlotData;pub use plots::PlotError;pub use plots::bar::BarPlot;pub use plots::bar::PositionalBarPlot;pub use plots::error_bars::AsymmetricErrorBarsPlot;pub use plots::error_bars::ErrorBarsPlot;pub use plots::error_bars::SimpleErrorBarsPlot;pub use plots::heatmap::HeatmapPlot;pub use plots::heatmap::HeatmapPlotF32;pub use plots::histogram::Histogram2DPlot;pub use plots::histogram::HistogramPlot;pub use plots::line::LinePlot;pub use plots::line::SimpleLinePlot;pub use plots::pie::PieChartPlot;pub use plots::pie::PieChartPlotF32;pub use plots::scatter::ScatterPlot;pub use plots::scatter::SimpleScatterPlot;pub use plots::shaded::ShadedBetweenPlot;pub use plots::shaded::ShadedPlot;pub use plots::shaded::SimpleShadedPlot;pub use plots::stems::SimpleStemPlot;pub use plots::stems::StemPlot;pub use plots::*;
Modules§
- plots
- Modular plot types for ImPlot
Macros§
- dummy_
plots - Macro for creating multiple dummy plots easily
- legend_
group - Macro for creating a legend group
- plot_
text - Convenience macro for creating formatted text plots
Structs§
- Axis
Flags - Axis flags matching ImPlotAxisFlags_ (see cimplot.h)
- Axis
Formatter Token - Axis
Transform Token - BarGroups
Flags - Flags for bar groups plots
- Bars
Flags - Flags for bar plots
- Context
- An imgui context.
- Digital
Flags - Flags for digital plots
- Drag
Result - Result of a drag interaction
- Drag
Tool Flags - Flags for drag tools (points/lines)
- Dummy
Flags - Flags for dummy plots
- Error
Bars Flags - Flags for error bar plots
- Heatmap
Flags - Flags for heatmap plots
- Histogram
Flags - Flags for histogram plots
- Image
Flags - Flags for image plots
- InfLines
Flags - Flags for infinite lines plots
- Legend
Flags - Flags for legend configuration
- Legend
Manager - Legend management utilities
- Legend
Token - Token representing an active legend
- Line
Flags - Flags for line plots
- Multi
Axis Plot - Multi-axis plot support
- Multi
Axis Token - Token representing an active multi-axis plot
- PieChart
Flags - Flags for pie chart plots
- Plot
Context - ImPlot context that manages the plotting state
- Plot
Flags - Flags for plot configuration
- Plot
Token - Token that represents an active plot
- PlotUi
- A temporary reference for building plots
- Scatter
Flags - Flags for scatter plots
- Shaded
Flags - Flags for shaded plots
- Stairs
Flags - Flags for stairs plots
- Stems
Flags - Flags for stem plots
- Style
Color Token - Token for managing style color changes
- Style
VarToken - Token for managing style variable changes
- Subplot
Flags - Flags for subplot configuration
- Subplot
Grid - Multi-plot layout manager for creating subplot grids
- Subplot
Token - Token representing an active subplot grid
- Text
Flags - Flags for text plots
- Ui
- Represents the Dear ImGui user interface for one frame
- YAxis
Config - Configuration for a Y-axis
Enums§
- BinMethod
- Binning methods for histograms
- Colormap
- Built-in colormaps
- Legend
Location - Legend location options
- Marker
- Markers for plot points
- Plot
Color Element - Colorable plot elements
- Plot
Cond - Plot condition (setup/next) matching ImPlotCond (ImGuiCond)
- Plot
Location - Plot location for legends, labels, etc.
- Plot
Orientation - Plot orientation
- Style
Var - Style variables that can be modified
- XAxis
- X axis selector matching ImPlot’s ImAxis values
- YAxis
- Y axis selector matching ImPlot’s ImAxis values
- YAxis
Choice - Choice of Y axis for multi-axis plots
Traits§
- ImPlot
Ext - Ui extension for obtaining a PlotUi from an ImPlot PlotContext
Functions§
- add_
colormap - Add a custom colormap from a vector of colors
- annotation_
point - Draw a simple round annotation marker at (x,y)
- colormap_
button - Draw a colormap picker button; returns true if clicked
- colormap_
scale - Draw a colormap scale widget
- colormap_
slider - Draw a colormap slider; returns true if selection changed
- drag_
line_ x - Draggable vertical line at x
- drag_
line_ y - Draggable horizontal line at y
- drag_
point - Draggable point with result flags
- get_
plot_ draw_ list - Get the underlying ImDrawList for the current plot (unsafe pointer)
- get_
plot_ limits - Get the current plot limits
- get_
plot_ limits_ axes - Get the current plot limits for specific axes
- get_
plot_ mouse_ position - Get the mouse position in plot coordinates
- get_
plot_ mouse_ position_ axes - Get the mouse position in plot coordinates for specific axes
- get_
plot_ pos - Get current plot position (top-left) in pixels
- get_
plot_ selection_ axes - Get the current plot selection rectangle for specific axes
- get_
plot_ size - Get current plot size in pixels
- is_
axis_ hovered - Check if an axis is hovered
- is_
legend_ entry_ hovered - Check if a legend entry is hovered
- is_
plot_ hovered - Check if the plot area is hovered
- is_
plot_ selected - Whether a plot has an active selection region
- is_
plot_ x_ axis_ hovered - Check if the X axis is hovered
- is_
plot_ x_ axis_ hovered_ axis - Check if a specific X axis is hovered
- is_
plot_ y_ axis_ hovered - Check if a Y axis is hovered
- is_
plot_ y_ axis_ hovered_ axis - Check if a specific Y axis is hovered
- is_
subplots_ hovered - Check if any subplots area is hovered
- map_
input_ default - Map input to defaults
- map_
input_ reverse - Map input to reversed scheme
- pixels_
to_ plot - Convert pixels to plot coordinates
- pixels_
to_ plot_ axes - Convert pixels to plot coordinates for specific axes
- plot_
to_ pixels - Convert plot coordinates to pixels
- plot_
to_ pixels_ axes - Convert plot coordinates to pixels for specific axes
- pop_
colormap - Pop a colormap from the stack
- pop_
plot_ clip_ rect - Pop plot clip rect
- push_
colormap - Push a colormap to the stack
- push_
plot_ clip_ rect - Push plot clip rect
- push_
style_ color - Push a style color to the stack
- push_
style_ var_ f32 - Push a float style variable to the stack
- push_
style_ var_ i32 - Push an integer style variable to the stack (converted to float)
- push_
style_ var_ vec2 - Push a Vec2 style variable to the stack
- show_
colormap_ selector - Show the ImPlot colormap selector combo; returns true if selection changed
- show_
demo_ window - Stub when demo feature is disabled
- show_
input_ map_ selector - Show the ImPlot input-map selector combo; returns true if selection changed
- show_
metrics_ window - Show the metrics window (pass &mut bool for open state)
- show_
style_ editor - Show the ImPlot style editor window
- show_
style_ selector - Show the ImPlot style selector combo; returns true if selection changed
- show_
user_ guide - Show the built-in user guide for ImPlot
- tag_x
- Tag the X axis at position x with a tick-like mark
- tag_y
- Tag the Y axis at position y with a tick-like mark