ImPlot: 2D plots for Dear ImGui: lines, scatter, bars, shaded areas, heatmaps, histograms, pie charts, real-time data.
A plot lives between begin_plot() and end_plot(): the setup_* functions (axes, limits, legend) come first,
then the plot_* functions. Run the app with immapp.run(..., with_implot=True), which creates ImPlot’s context.
In Python, the data are numpy arrays. ImPlot’s functions are templated on one numeric type, so the arrays of one
call must share their dtype: convert them first (xs = xs.astype(ys.dtype)). Mismatched dtypes raise an error.
The module imgui_bundle.implot, the Python API of ImPlot, from bindings/imgui_bundle/implot/__init__.pyi: 125 functions, 8 classes, 36 enums. Each entry gives the Python signature, then the C++ one, then the doc of the C++ header. The sections are the header’s.
Start with: begin_plot, end_plot, plot_line, plot_scatter, setup_axes.
implot.h¶
BoxedValue (class)¶
| Attribute | C++ | |
|---|---|---|
value: float | double value; |
BoxedValue.__init__¶
def __init__(self, value: float = float()) -> NoneAuto-generated default constructor with named params
Enums and Types¶
Forward declarations¶
Enums/Flags
ImAxis_ (enum)¶
Axis indices. The values assigned may change; NEVER hardcode these.
| Member | Value | C++ | |
|---|---|---|---|
x1 | 0 | ImAxis_X1 = 0 | enabled by default |
x2 | 1 | ImAxis_X2 | disabled by default |
x3 | 2 | ImAxis_X3 | disabled by default |
y1 | 3 | ImAxis_Y1 | enabled by default |
y2 | 4 | ImAxis_Y2 | disabled by default |
y3 | 5 | ImAxis_Y3 | disabled by default |
count | 6 | ImAxis_COUNT |
Prop_ (enum)¶
Plotting properties. These provide syntactic sugar for creating ImPlotSpecs from (ImPlotProp,value) pairs. See ImPlotSpec documentation.
| Member | Value | C++ | |
|---|---|---|---|
line_color | 0 | ImPlotProp_LineColor | line color (applies to lines, bar edges); IMPLOT_AUTO_COL will use next Colormap color or current item color |
line_colors | 1 | ImPlotProp_LineColors | array of colors for each line; if None, use LineColor for all lines |
line_weight | 2 | ImPlotProp_LineWeight | line weight in pixels (applies to lines, bar edges, marker edges) |
fill_color | 3 | ImPlotProp_FillColor | fill color (applies to shaded regions, bar faces); IMPLOT_AUTO_COL will use next Colormap color or current item color |
fill_colors | 4 | ImPlotProp_FillColors | array of colors for each fill; if None, use FillColor for all fills |
fill_alpha | 5 | ImPlotProp_FillAlpha | alpha multiplier (applies to FillColor, FillColors, MarkerFillColor, and MarkerFillColors) |
marker | 6 | ImPlotProp_Marker | marker type; specify ImPlotMarker_Auto to use the next unused marker |
marker_size | 7 | ImPlotProp_MarkerSize | size of markers (radius) in pixels |
marker_sizes | 8 | ImPlotProp_MarkerSizes | array of sizes for each marker; if None, use MarkerSize for all markers |
marker_line_color | 9 | ImPlotProp_MarkerLineColor | marker edge color; IMPLOT_AUTO_COL will use LineColor |
marker_line_colors | 10 | ImPlotProp_MarkerLineColors | array of colors for each marker edge; if None, use MarkerLineColor for all markers |
marker_fill_color | 11 | ImPlotProp_MarkerFillColor | marker face color; IMPLOT_AUTO_COL will use LineColor |
marker_fill_colors | 12 | ImPlotProp_MarkerFillColors | array of colors for each marker face; if None, use MarkerFillColor for all markers |
size | 13 | ImPlotProp_Size | size of error bar whiskers (width or height), and digital bars (height) in pixels |
offset | 14 | ImPlotProp_Offset | data index offset |
stride | 15 | ImPlotProp_Stride | data stride in bytes; IMPLOT_AUTO will result in sizeof(T) where T is the type passed to PlotX |
flags | 16 | ImPlotProp_Flags | optional item flags; can be composed from common ImPlotItemFlags and/or specialized ImPlotXFlags |
Flags_ (enum)¶
Options for plots (see BeginPlot).
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotFlags_None = 0 | default |
no_title | 1 << 0 | ImPlotFlags_NoTitle = 1 << 0 | the plot title will not be displayed (titles are also hidden if preceded by double hashes, e.g. “##MyPlot”) |
no_legend | 1 << 1 | ImPlotFlags_NoLegend = 1 << 1 | the legend will not be displayed |
no_mouse_text | 1 << 2 | ImPlotFlags_NoMouseText = 1 << 2 | the mouse position, in plot coordinates, will not be displayed inside of the plot |
no_inputs | 1 << 3 | ImPlotFlags_NoInputs = 1 << 3 | the user will not be able to interact with the plot |
no_menus | 1 << 4 | ImPlotFlags_NoMenus = 1 << 4 | the user will not be able to open context menus |
no_box_select | 1 << 5 | ImPlotFlags_NoBoxSelect = 1 << 5 | the user will not be able to box-select |
no_frame | 1 << 6 | ImPlotFlags_NoFrame = 1 << 6 | the ImGui frame will not be rendered |
equal | 1 << 7 | ImPlotFlags_Equal = 1 << 7 | x and y axes pairs will be constrained to have the same units/pixel |
crosshairs | 1 << 8 | ImPlotFlags_Crosshairs = 1 << 8 | the default mouse cursor will be replaced with a crosshair when hovered |
canvas_only | Flags_NoTitle | Flags_NoLegend | Flags_NoMenus | Flags_NoBoxSelect | Flags_NoMouseText | ImPlotFlags_CanvasOnly = ImPlotFlags_NoTitle | ImPlotFlags_NoLegend | ImPlotFlags_NoMenus | ImPlotFlags_NoBoxSelect | ImPlotFlags_NoMouseText |
AxisFlags_ (enum)¶
Options for plot axes (see SetupAxis).
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotAxisFlags_None = 0 | default |
no_label | 1 << 0 | ImPlotAxisFlags_NoLabel = 1 << 0 | the axis label will not be displayed (axis labels are also hidden if the supplied string name is None) |
no_grid_lines | 1 << 1 | ImPlotAxisFlags_NoGridLines = 1 << 1 | no grid lines will be displayed |
no_tick_marks | 1 << 2 | ImPlotAxisFlags_NoTickMarks = 1 << 2 | no tick marks will be displayed |
no_tick_labels | 1 << 3 | ImPlotAxisFlags_NoTickLabels = 1 << 3 | no text labels will be displayed |
no_initial_fit | 1 << 4 | ImPlotAxisFlags_NoInitialFit = 1 << 4 | axis will not be initially fit to data extents on the first rendered frame |
no_menus | 1 << 5 | ImPlotAxisFlags_NoMenus = 1 << 5 | the user will not be able to open context menus with right-click |
no_side_switch | 1 << 6 | ImPlotAxisFlags_NoSideSwitch = 1 << 6 | the user will not be able to switch the axis side by dragging it |
no_highlight | 1 << 7 | ImPlotAxisFlags_NoHighlight = 1 << 7 | the axis will not have its background highlighted when hovered or held |
opposite | 1 << 8 | ImPlotAxisFlags_Opposite = 1 << 8 | axis ticks and labels will be rendered on the conventionally opposite side (i.e, right or top) |
foreground | 1 << 9 | ImPlotAxisFlags_Foreground = 1 << 9 | grid lines will be displayed in the foreground (i.e. on top of data) instead of the background |
invert | 1 << 10 | ImPlotAxisFlags_Invert = 1 << 10 | the axis will be inverted |
auto_fit | 1 << 11 | ImPlotAxisFlags_AutoFit = 1 << 11 | axis will be auto-fitting to data extents |
range_fit | 1 << 12 | ImPlotAxisFlags_RangeFit = 1 << 12 | axis will only fit points if the point is in the visible range of the orthogonal axis |
pan_stretch | 1 << 13 | ImPlotAxisFlags_PanStretch = 1 << 13 | panning in a locked or constrained state will cause the axis to stretch if possible |
lock_min | 1 << 14 | ImPlotAxisFlags_LockMin = 1 << 14 | the axis minimum value will be locked when panning/zooming |
lock_max | 1 << 15 | ImPlotAxisFlags_LockMax = 1 << 15 | the axis maximum value will be locked when panning/zooming |
lock | AxisFlags_LockMin | AxisFlags_LockMax | ImPlotAxisFlags_Lock = ImPlotAxisFlags_LockMin | ImPlotAxisFlags_LockMax | |
no_decorations | AxisFlags_NoLabel | AxisFlags_NoGridLines | AxisFlags_NoTickMarks | AxisFlags_NoTickLabels | ImPlotAxisFlags_NoDecorations = ImPlotAxisFlags_NoLabel | ImPlotAxisFlags_NoGridLines | ImPlotAxisFlags_NoTickMarks | ImPlotAxisFlags_NoTickLabels | |
aux_default | AxisFlags_NoGridLines | AxisFlags_Opposite | ImPlotAxisFlags_AuxDefault = ImPlotAxisFlags_NoGridLines | ImPlotAxisFlags_Opposite |
SubplotFlags_ (enum)¶
Options for subplots (see BeginSubplot)
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotSubplotFlags_None = 0 | default |
no_title | 1 << 0 | ImPlotSubplotFlags_NoTitle = 1 << 0 | the subplot title will not be displayed (titles are also hidden if preceded by double hashes, e.g. “##MySubplot”) |
no_legend | 1 << 1 | ImPlotSubplotFlags_NoLegend = 1 << 1 | the legend will not be displayed (only applicable if ImPlotSubplotFlags_ShareItems is enabled) |
no_menus | 1 << 2 | ImPlotSubplotFlags_NoMenus = 1 << 2 | the user will not be able to open context menus with right-click |
no_resize | 1 << 3 | ImPlotSubplotFlags_NoResize = 1 << 3 | resize splitters between subplot cells will be not be provided |
no_align | 1 << 4 | ImPlotSubplotFlags_NoAlign = 1 << 4 | subplot edges will not be aligned vertically or horizontally |
share_items | 1 << 5 | ImPlotSubplotFlags_ShareItems = 1 << 5 | items across all subplots will be shared and rendered into a single legend entry |
link_rows | 1 << 6 | ImPlotSubplotFlags_LinkRows = 1 << 6 | link the y-axis limits of all plots in each row (does not apply to auxiliary axes) |
link_cols | 1 << 7 | ImPlotSubplotFlags_LinkCols = 1 << 7 | link the x-axis limits of all plots in each column (does not apply to auxiliary axes) |
link_all_x | 1 << 8 | ImPlotSubplotFlags_LinkAllX = 1 << 8 | link the x-axis limits in every plot in the subplot (does not apply to auxiliary axes) |
link_all_y | 1 << 9 | ImPlotSubplotFlags_LinkAllY = 1 << 9 | link the y-axis limits in every plot in the subplot (does not apply to auxiliary axes) |
col_major | 1 << 10 | ImPlotSubplotFlags_ColMajor = 1 << 10 | subplots are added in column major order instead of the default row major order |
LegendFlags_ (enum)¶
Options for legends (see SetupLegend)
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotLegendFlags_None = 0 | default |
no_buttons | 1 << 0 | ImPlotLegendFlags_NoButtons = 1 << 0 | legend icons will not function as hide/show buttons |
no_highlight_item | 1 << 1 | ImPlotLegendFlags_NoHighlightItem = 1 << 1 | plot items will not be highlighted when their legend entry is hovered |
no_highlight_axis | 1 << 2 | ImPlotLegendFlags_NoHighlightAxis = 1 << 2 | axes will not be highlighted when legend entries are hovered (only relevant if x/y-axis count > 1) |
no_menus | 1 << 3 | ImPlotLegendFlags_NoMenus = 1 << 3 | the user will not be able to open context menus with right-click |
outside | 1 << 4 | ImPlotLegendFlags_Outside = 1 << 4 | legend will be rendered outside of the plot area |
horizontal | 1 << 5 | ImPlotLegendFlags_Horizontal = 1 << 5 | legend entries will be displayed horizontally |
sort | 1 << 6 | ImPlotLegendFlags_Sort = 1 << 6 | legend entries will be displayed in alphabetical order |
reverse | 1 << 7 | ImPlotLegendFlags_Reverse = 1 << 7 | legend entries will be displayed in reverse order |
MouseTextFlags_ (enum)¶
Options for mouse hover text (see SetupMouseText)
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotMouseTextFlags_None = 0 | default |
no_aux_axes | 1 << 0 | ImPlotMouseTextFlags_NoAuxAxes = 1 << 0 | only show the mouse position for primary axes |
no_format | 1 << 1 | ImPlotMouseTextFlags_NoFormat = 1 << 1 | axes label formatters won’t be used to render text |
show_always | 1 << 2 | ImPlotMouseTextFlags_ShowAlways = 1 << 2 | always display mouse position even if plot not hovered |
DragToolFlags_ (enum)¶
Options for DragPoint, DragLine, DragRect
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotDragToolFlags_None = 0 | default |
no_cursors | 1 << 0 | ImPlotDragToolFlags_NoCursors = 1 << 0 | drag tools won’t change cursor icons when hovered or held |
no_fit | 1 << 1 | ImPlotDragToolFlags_NoFit = 1 << 1 | the drag tool won’t be considered for plot fits |
no_inputs | 1 << 2 | ImPlotDragToolFlags_NoInputs = 1 << 2 | lock the tool from user inputs |
delayed | 1 << 3 | ImPlotDragToolFlags_Delayed = 1 << 3 | tool rendering will be delayed one frame; useful when applying position-constraints |
ColormapScaleFlags_ (enum)¶
Flags for ColormapScale
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotColormapScaleFlags_None = 0 | default |
no_label | 1 << 0 | ImPlotColormapScaleFlags_NoLabel = 1 << 0 | the colormap axis label will not be displayed |
opposite | 1 << 1 | ImPlotColormapScaleFlags_Opposite = 1 << 1 | render the colormap label and tick labels on the opposite side |
invert | 1 << 2 | ImPlotColormapScaleFlags_Invert = 1 << 2 | invert the colormap bar and axis scale (this only affects rendering; if you only want to reverse the scale mapping, make scale_min > scale_max) |
ItemFlags_ (enum)¶
Flags for ANY PlotX function. Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotItemFlags_None = 0 | |
no_legend | 1 << 0 | ImPlotItemFlags_NoLegend = 1 << 0 | the item won’t have a legend entry displayed |
no_fit | 1 << 1 | ImPlotItemFlags_NoFit = 1 << 1 | the item won’t be considered for plot fits |
LineFlags_ (enum)¶
Flags for PlotLine. Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotLineFlags_None = 0 | default |
segments | 1 << 10 | ImPlotLineFlags_Segments = 1 << 10 | a line segment will be rendered from every two consecutive points |
loop | 1 << 11 | ImPlotLineFlags_Loop = 1 << 11 | the last and first point will be connected to form a closed loop |
skip_nan | 1 << 12 | ImPlotLineFlags_SkipNaN = 1 << 12 | NaNs values will be skipped instead of rendered as missing data |
no_clip | 1 << 13 | ImPlotLineFlags_NoClip = 1 << 13 | markers (if displayed) on the edge of a plot will not be clipped |
shaded | 1 << 14 | ImPlotLineFlags_Shaded = 1 << 14 | a filled region between the line and horizontal origin will be rendered; use PlotShaded for more advanced cases |
ScatterFlags_ (enum)¶
Flags for PlotScatter. Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotScatterFlags_None = 0 | default |
no_clip | 1 << 10 | ImPlotScatterFlags_NoClip = 1 << 10 | markers on the edge of a plot will not be clipped |
BubblesFlags_ (enum)¶
Flags for PlotBubbles. Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotBubblesFlags_None = 0 | default |
PolygonFlags_ (enum)¶
Flags for PlotPolygon. Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotPolygonFlags_None = 0 | default (closed, convex polygon) |
concave | 1 << 10 | ImPlotPolygonFlags_Concave = 1 << 10 | use concave polygon filling (slower but supports concave shapes) |
StairsFlags_ (enum)¶
Flags for PlotStairs. Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotStairsFlags_None = 0 | default |
pre_step | 1 << 10 | ImPlotStairsFlags_PreStep = 1 << 10 | the y value is continued constantly to the left from every x position, i.e. the interval (x[i-1], x[i]] has the value y[i] |
shaded | 1 << 11 | ImPlotStairsFlags_Shaded = 1 << 11 | a filled region between the stairs and horizontal origin will be rendered; use PlotShaded for more advanced cases |
ShadedFlags_ (enum)¶
Flags for PlotShaded (placeholder). Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotShadedFlags_None = 0 | default |
BarsFlags_ (enum)¶
Flags for PlotBars. Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotBarsFlags_None = 0 | default |
horizontal | 1 << 10 | ImPlotBarsFlags_Horizontal = 1 << 10 | bars will be rendered horizontally on the current y-axis |
BarGroupsFlags_ (enum)¶
Flags for PlotBarGroups. Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotBarGroupsFlags_None = 0 | default |
horizontal | 1 << 10 | ImPlotBarGroupsFlags_Horizontal = 1 << 10 | bar groups will be rendered horizontally on the current y-axis |
stacked | 1 << 11 | ImPlotBarGroupsFlags_Stacked = 1 << 11 | items in a group will be stacked on top of each other |
ErrorBarsFlags_ (enum)¶
Flags for PlotErrorBars. Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotErrorBarsFlags_None = 0 | default |
horizontal | 1 << 10 | ImPlotErrorBarsFlags_Horizontal = 1 << 10 | error bars will be rendered horizontally on the current y-axis |
StemsFlags_ (enum)¶
Flags for PlotStems. Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotStemsFlags_None = 0 | default |
horizontal | 1 << 10 | ImPlotStemsFlags_Horizontal = 1 << 10 | stems will be rendered horizontally on the current y-axis |
InfLinesFlags_ (enum)¶
Flags for PlotInfLines. Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotInfLinesFlags_None = 0 | default |
horizontal | 1 << 10 | ImPlotInfLinesFlags_Horizontal = 1 << 10 | lines will be rendered horizontally on the current y-axis |
PieChartFlags_ (enum)¶
Flags for PlotPieChart. Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotPieChartFlags_None = 0 | default |
normalize | 1 << 10 | ImPlotPieChartFlags_Normalize = 1 << 10 | force normalization of pie chart values (i.e. always make a full circle if sum < 0) |
ignore_hidden | 1 << 11 | ImPlotPieChartFlags_IgnoreHidden = 1 << 11 | ignore hidden slices when drawing the pie chart (as if they were not there) |
exploding | 1 << 12 | ImPlotPieChartFlags_Exploding = 1 << 12 | explode legend-hovered slice |
no_slice_border | 1 << 13 | ImPlotPieChartFlags_NoSliceBorder = 1 << 13 | do not draw slice borders |
HeatmapFlags_ (enum)¶
Flags for PlotHeatmap. Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotHeatmapFlags_None = 0 | default |
col_major | 1 << 10 | ImPlotHeatmapFlags_ColMajor = 1 << 10 | data will be read in column major order |
HistogramFlags_ (enum)¶
Flags for PlotHistogram and PlotHistogram2D. Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotHistogramFlags_None = 0 | default |
horizontal | 1 << 10 | ImPlotHistogramFlags_Horizontal = 1 << 10 | histogram bars will be rendered horizontally (not supported by PlotHistogram2D) |
cumulative | 1 << 11 | ImPlotHistogramFlags_Cumulative = 1 << 11 | each bin will contain its count plus the counts of all previous bins (not supported by PlotHistogram2D) |
density | 1 << 12 | ImPlotHistogramFlags_Density = 1 << 12 | counts will be normalized, i.e. the PDF will be visualized, or the CDF will be visualized if Cumulative is also set |
no_outliers | 1 << 13 | ImPlotHistogramFlags_NoOutliers = 1 << 13 | exclude values outside the specified histogram range from the count toward normalizing and cumulative counts |
col_major | 1 << 14 | ImPlotHistogramFlags_ColMajor = 1 << 14 | data will be read in column major order (not supported by PlotHistogram) |
DigitalFlags_ (enum)¶
Flags for PlotDigital (placeholder). Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotDigitalFlags_None = 0 | default |
ImageFlags_ (enum)¶
Flags for PlotImage (placeholder). Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotImageFlags_None = 0 | default |
TextFlags_ (enum)¶
Flags for PlotText. Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotTextFlags_None = 0 | default |
vertical | 1 << 10 | ImPlotTextFlags_Vertical = 1 << 10 | text will be rendered vertically |
DummyFlags_ (enum)¶
Flags for PlotDummy (placeholder). Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotDummyFlags_None = 0 | default |
Cond_ (enum)¶
Represents a condition for SetupAxisLimits etc. (same as ImGuiCond, but we only support a subset of those enums)
| Member | Value | C++ | |
|---|---|---|---|
none | Cond_None | ImPlotCond_None = ImGuiCond_None | No condition (always set the variable), same as _Always |
always | Cond_Always | ImPlotCond_Always = ImGuiCond_Always | No condition (always set the variable) |
once | Cond_Once | ImPlotCond_Once = ImGuiCond_Once | Set the variable once per runtime session (only the first call will succeed) |
Col_ (enum)¶
Plot styling colors.
| Member | Value | C++ | |
|---|---|---|---|
frame_bg | 0 | ImPlotCol_FrameBg | plot frame background color (defaults to ImGuiCol_FrameBg) |
plot_bg | 1 | ImPlotCol_PlotBg | plot area background color (defaults to ImGuiCol_WindowBg) |
plot_border | 2 | ImPlotCol_PlotBorder | plot area border color (defaults to ImGuiCol_Border) |
legend_bg | 3 | ImPlotCol_LegendBg | legend background color (defaults to ImGuiCol_PopupBg) |
legend_border | 4 | ImPlotCol_LegendBorder | legend border color (defaults to ImPlotCol_PlotBorder) |
legend_text | 5 | ImPlotCol_LegendText | legend text color (defaults to ImPlotCol_InlayText) |
title_text | 6 | ImPlotCol_TitleText | plot title text color (defaults to ImGuiCol_Text) |
inlay_text | 7 | ImPlotCol_InlayText | color of text appearing inside of plots (defaults to ImGuiCol_Text) |
axis_text | 8 | ImPlotCol_AxisText | axis label and tick labels color (defaults to ImGuiCol_Text) |
axis_grid | 9 | ImPlotCol_AxisGrid | axis grid color (defaults to 25% ImPlotCol_AxisText) |
axis_tick | 10 | ImPlotCol_AxisTick | axis tick color (defaults to AxisGrid) |
axis_bg | 11 | ImPlotCol_AxisBg | background color of axis hover region (defaults to transparent) |
axis_bg_hovered | 12 | ImPlotCol_AxisBgHovered | axis hover color (defaults to ImGuiCol_ButtonHovered) |
axis_bg_active | 13 | ImPlotCol_AxisBgActive | axis active color (defaults to ImGuiCol_ButtonActive) |
selection | 14 | ImPlotCol_Selection | box-selection color (defaults to yellow) |
crosshairs | 15 | ImPlotCol_Crosshairs | crosshairs color (defaults to ImPlotCol_PlotBorder) |
count | 16 | ImPlotCol_COUNT |
StyleVar_ (enum)¶
Plot styling variables.
| Member | Value | C++ | |
|---|---|---|---|
plot_default_size | 0 | ImPlotStyleVar_PlotDefaultSize | ImVec2, default size used when ImVec2(0,0) is passed to BeginPlot |
plot_min_size | 1 | ImPlotStyleVar_PlotMinSize | ImVec2, minimum size plot frame can be when shrunk |
plot_border_size | 2 | ImPlotStyleVar_PlotBorderSize | float, thickness of border around plot area |
minor_alpha | 3 | ImPlotStyleVar_MinorAlpha | float, alpha multiplier applied to minor axis grid lines |
major_tick_len | 4 | ImPlotStyleVar_MajorTickLen | ImVec2, major tick lengths for X and Y axes |
minor_tick_len | 5 | ImPlotStyleVar_MinorTickLen | ImVec2, minor tick lengths for X and Y axes |
major_tick_size | 6 | ImPlotStyleVar_MajorTickSize | ImVec2, line thickness of major ticks |
minor_tick_size | 7 | ImPlotStyleVar_MinorTickSize | ImVec2, line thickness of minor ticks |
major_grid_size | 8 | ImPlotStyleVar_MajorGridSize | ImVec2, line thickness of major grid lines |
minor_grid_size | 9 | ImPlotStyleVar_MinorGridSize | ImVec2, line thickness of minor grid lines |
plot_padding | 10 | ImPlotStyleVar_PlotPadding | ImVec2, padding between widget frame and plot area, labels, or outside legends (i.e. main padding) |
label_padding | 11 | ImPlotStyleVar_LabelPadding | ImVec2, padding between axes labels, tick labels, and plot edge |
legend_padding | 12 | ImPlotStyleVar_LegendPadding | ImVec2, legend padding from plot edges |
legend_inner_padding | 13 | ImPlotStyleVar_LegendInnerPadding | ImVec2, legend inner padding from legend edges |
legend_spacing | 14 | ImPlotStyleVar_LegendSpacing | ImVec2, spacing between legend entries |
mouse_pos_padding | 15 | ImPlotStyleVar_MousePosPadding | ImVec2, padding between plot edge and interior info text |
annotation_padding | 16 | ImPlotStyleVar_AnnotationPadding | ImVec2, text padding around annotation labels |
fit_padding | 17 | ImPlotStyleVar_FitPadding | ImVec2, additional fit padding as a percentage of the fit extents (e.g. ImVec2(0.1,0.1) adds 10% to the fit extents of X and Y) |
digital_padding | 18 | ImPlotStyleVar_DigitalPadding | float, digital plot padding from bottom in pixels |
digital_spacing | 19 | ImPlotStyleVar_DigitalSpacing | float, digital plot spacing gap in pixels |
count | 20 | ImPlotStyleVar_COUNT |
Scale_ (enum)¶
Axis scale
| Member | Value | C++ | |
|---|---|---|---|
linear | 0 | ImPlotScale_Linear = 0 | default linear scale |
time | 1 | ImPlotScale_Time | date/time scale |
log10 | 2 | ImPlotScale_Log10 | base 10 logarithmic scale |
sym_log | 3 | ImPlotScale_SymLog | symmetric log scale |
Marker_ (enum)¶
Marker specifications.
| Member | Value | C++ | |
|---|---|---|---|
none | -2 | ImPlotMarker_None = -2 | no marker |
auto | -1 | ImPlotMarker_Auto = -1 | automatic marker selection |
circle | 0 | ImPlotMarker_Circle | a circle marker (default) |
square | 1 | ImPlotMarker_Square | a square maker |
diamond | 2 | ImPlotMarker_Diamond | a diamond marker |
up | 3 | ImPlotMarker_Up | an upward-pointing triangle marker |
down | 4 | ImPlotMarker_Down | an downward-pointing triangle marker |
left | 5 | ImPlotMarker_Left | an leftward-pointing triangle marker |
right | 6 | ImPlotMarker_Right | an rightward-pointing triangle marker |
cross | 7 | ImPlotMarker_Cross | a cross marker (not fill-able) |
plus | 8 | ImPlotMarker_Plus | a plus marker (not fill-able) |
asterisk | 9 | ImPlotMarker_Asterisk | a asterisk marker (not fill-able) |
vertical | 10 | ImPlotMarker_Vertical | a vertical line marker (not fill-able) |
horizontal | 11 | ImPlotMarker_Horizontal | a horizontal line marker (not fill-able) |
count | 12 | ImPlotMarker_COUNT |
Colormap_ (enum)¶
Built-in colormaps
| Member | Value | C++ | |
|---|---|---|---|
deep | 0 | ImPlotColormap_Deep = 0 | a.k.a. seaborn deep (qual=True, n=10) (default) |
dark | 1 | ImPlotColormap_Dark = 1 | a.k.a. matplotlib “Set1” (qual=True, n=9 ) |
pastel | 2 | ImPlotColormap_Pastel = 2 | a.k.a. matplotlib “Pastel1” (qual=True, n=9 ) |
paired | 3 | ImPlotColormap_Paired = 3 | a.k.a. matplotlib “Paired” (qual=True, n=12) |
viridis | 4 | ImPlotColormap_Viridis = 4 | a.k.a. matplotlib “viridis” (qual=False, n=11) |
plasma | 5 | ImPlotColormap_Plasma = 5 | a.k.a. matplotlib “plasma” (qual=False, n=11) |
hot | 6 | ImPlotColormap_Hot = 6 | a.k.a. matplotlib/MATLAB “hot” (qual=False, n=11) |
cool | 7 | ImPlotColormap_Cool = 7 | a.k.a. matplotlib/MATLAB “cool” (qual=False, n=11) |
pink | 8 | ImPlotColormap_Pink = 8 | a.k.a. matplotlib/MATLAB “pink” (qual=False, n=11) |
jet | 9 | ImPlotColormap_Jet = 9 | a.k.a. MATLAB “jet” (qual=False, n=11) |
twilight | 10 | ImPlotColormap_Twilight = 10 | a.k.a. matplotlib “twilight” (qual=False, n=11) |
rd_bu | 11 | ImPlotColormap_RdBu = 11 | red/blue, Color Brewer (qual=False, n=11) |
br_bg | 12 | ImPlotColormap_BrBG = 12 | brown/blue-green, Color Brewer (qual=False, n=11) |
pi_yg | 13 | ImPlotColormap_PiYG = 13 | pink/yellow-green, Color Brewer (qual=False, n=11) |
spectral | 14 | ImPlotColormap_Spectral = 14 | color spectrum, Color Brewer (qual=False, n=11) |
greys | 15 | ImPlotColormap_Greys = 15 | white/black (qual=False, n=2 ) |
Location_ (enum)¶
Used to position items on a plot (e.g. legends, labels, etc.)
| Member | Value | C++ | |
|---|---|---|---|
center | 0 | ImPlotLocation_Center = 0 | center-center |
north | 1 << 0 | ImPlotLocation_North = 1 << 0 | top-center |
south | 1 << 1 | ImPlotLocation_South = 1 << 1 | bottom-center |
west | 1 << 2 | ImPlotLocation_West = 1 << 2 | center-left |
east | 1 << 3 | ImPlotLocation_East = 1 << 3 | center-right |
north_west | Location_North | Location_West | ImPlotLocation_NorthWest = ImPlotLocation_North | ImPlotLocation_West | top-left |
north_east | Location_North | Location_East | ImPlotLocation_NorthEast = ImPlotLocation_North | ImPlotLocation_East | top-right |
south_west | Location_South | Location_West | ImPlotLocation_SouthWest = ImPlotLocation_South | ImPlotLocation_West | bottom-left |
south_east | Location_South | Location_East | ImPlotLocation_SouthEast = ImPlotLocation_South | ImPlotLocation_East | bottom-right |
Bin_ (enum)¶
Enums for different automatic histogram binning methods (k = bin count or w = bin width)
| Member | Value | C++ | |
|---|---|---|---|
sqrt | -1 | ImPlotBin_Sqrt = -1 | k = sqrt(n) |
sturges | -2 | ImPlotBin_Sturges = -2 | k = 1 + log2(n) |
rice | -3 | ImPlotBin_Rice = -3 | k = 2 * cbrt(n) |
scott | -4 | ImPlotBin_Scott = -4 | w = 3.49 * sigma / cbrt(n) |
Spec (class)¶
Plot item styling specification. Provide these to PlotX functions to override styling, specify offsetting or stride, or set optional flags. This struct can be used in the following ways:
By declaring and defining a struct instance:
Inline using (ImPlotProp,value) pairs (order does NOT matter):
ImPlot::PlotLine(“MyLine”, xs, ys, 100, { ImPlotProp_LineColor, ImVec4(1,0,0,1),
ImPlotProp_LineWeight, 2.0,
ImPlotProp_Marker, ImPlotMarker_Circle,
ImPlotProp_Flags, ImPlotItemFlags_NoLegend | ImPlotLineFlags_Segments
});| Attribute | C++ | |
|---|---|---|
line_color: ImVec4 | ImVec4 LineColor = IMPLOT_AUTO_COL; | line color (applies to lines, bar edges); IMPLOT_AUTO_COL will use next Colormap color or current item color |
line_weight: float | float LineWeight = 1.0f; | line weight in pixels (applies to lines, bar edges, marker edges) |
fill_color: ImVec4 | ImVec4 FillColor = IMPLOT_AUTO_COL; | fill color (applies to shaded regions, bar faces); IMPLOT_AUTO_COL will use next Colormap color or current item color |
fill_alpha: float | float FillAlpha = 1.0f; | alpha multiplier (applies to FillColor, FillColors, MarkerFillColor, and MarkerFillColors) |
marker: Marker | ImPlotMarker Marker = ImPlotMarker_None; | marker type; specify ImPlotMarker_Auto to use the next unused marker |
marker_size: float | float MarkerSize = 4; | size of markers (radius) in pixels |
marker_line_color: ImVec4 | ImVec4 MarkerLineColor = IMPLOT_AUTO_COL; | marker edge color; IMPLOT_AUTO_COL will use LineColor |
marker_fill_color: ImVec4 | ImVec4 MarkerFillColor = IMPLOT_AUTO_COL; | marker face color; IMPLOT_AUTO_COL will use LineColor |
size: float | float Size = 4; | size of error bar whiskers (width or height), and digital bars (height) in pixels |
offset: int | int Offset = 0; | data index offset |
stride: int | int Stride = IMPLOT_AUTO; | data stride in bytes; IMPLOT_AUTO will result in sizeof(T) where T is the type passed to PlotX |
flags: ItemFlags | ImPlotItemFlags Flags = ImPlotItemFlags_None; | optional item flags; can be composed from common ImPlotItemFlags and/or specialized ImPlotXFlags |
line_colors: Optional[np.ndarray] | `` | array of colors (np.uint32) for each line. Must have the same length as the data arrays. If None, use LineColor for all lines. |
fill_colors: Optional[np.ndarray] | `` | array of colors (np.uint32) for each fill. Must have the same length as the data arrays. If None, use FillColor for all fills. |
marker_line_colors: Optional[np.ndarray] | `` | array of colors (np.uint32) for each marker edge. Must have the same length as the data arrays. If None, use MarkerLineColor for all markers. |
marker_fill_colors: Optional[np.ndarray] | `` | array of colors (np.uint32) for each marker face. Must have the same length as the data arrays. If None, use MarkerFillColor for all markers. |
marker_sizes: Optional[np.ndarray] | `` | array of sizes (np.float32) for each marker. Must have the same length as the data arrays. If None, use MarkerSize for all markers. |
Spec.__init__¶
def __init__(self, line_color: Optional[ImVec4Like] = None, line_weight: float = 1.0, fill_color: Optional[ImVec4Like] = None, fill_alpha: float = 1.0, marker: Optional[Marker] = None, marker_size: float = 4, marker_line_color: Optional[ImVec4Like] = None, marker_fill_color: Optional[ImVec4Like] = None, size: float = 4, offset: int = 0, stride: int = IMPLOT_AUTO, flags: ItemFlags = ItemFlags_None) -> NoneAuto-generated default constructor with named params
Python bindings defaults:
If any of the params below is None, then its default value below will be used:
* LineColor: IMPLOT_AUTO_COL
* FillColor: IMPLOT_AUTO_COL
* Marker: Marker_None
* MarkerLineColor: IMPLOT_AUTO_COL
* MarkerFillColor: IMPLOT_AUTO_COL
Point (class)¶
| Attribute | C++ | |
|---|---|---|
x: float | double x, | |
y: float | y; |
Point.__init__¶
@overload
def __init__(self) -> None
@overload
def __init__(self, _x: float, _y: float) -> None
@overload
def __init__(self, p: ImVec2Like) -> Noneconstexpr ImPlotPoint() : x(0.0), y(0.0);
constexpr ImPlotPoint(double _x, double _y) : x(_x), y(_y);
constexpr ImPlotPoint(const ImVec2& p) : x((double)p.x), y((double)p.y);Range (class)¶
Range defined by a min/max value.
| Attribute | C++ | |
|---|---|---|
min: float | double Min, | |
max: float | Max; |
Range.__init__¶
@overload
def __init__(self) -> None
@overload
def __init__(self, _min: float, _max: float) -> Noneconstexpr ImPlotRange() : Min(0.0), Max(0.0);
constexpr ImPlotRange(double _min, double _max) : Min(_min), Max(_max);Range.contains¶
def contains(self, value: float) -> boolIMPLOT_API bool Contains(double value) const;Range.size¶
def size(self) -> floatIMPLOT_API double Size() const;Range.clamp¶
def clamp(self, value: float) -> floatIMPLOT_API double Clamp(double value) const;Rect (class)¶
Combination of two range limits for X and Y axes. Also an AABB defined by Min()/Max().
| Attribute | C++ | |
|---|---|---|
x: Range | ImPlotRange X, | |
y: Range | Y; |
Rect.__init__¶
@overload
def __init__(self) -> None
@overload
def __init__(self, x_min: float, x_max: float, y_min: float, y_max: float) -> Noneconstexpr ImPlotRect() : X(0.0,0.0), Y(0.0,0.0);
constexpr ImPlotRect(double x_min, double x_max, double y_min, double y_max) : X(x_min, x_max), Y(y_min, y_max);Rect.contains¶
@overload
def contains(self, p: Point) -> bool
@overload
def contains(self, x: float, y: float) -> boolIMPLOT_API bool Contains(const ImPlotPoint& p) const;
IMPLOT_API bool Contains(double x, double y) const;Rect.size¶
def size(self) -> PointIMPLOT_API ImPlotPoint Size() const;Rect.clamp¶
@overload
def clamp(self, p: Point) -> Point
@overload
def clamp(self, x: float, y: float) -> PointIMPLOT_API ImPlotPoint Clamp(const ImPlotPoint& p) const;
IMPLOT_API ImPlotPoint Clamp(double x, double y) const;Rect.min¶
def min(self) -> PointIMPLOT_API ImPlotPoint Min() const;Rect.max¶
def max(self) -> PointIMPLOT_API ImPlotPoint Max() const;Style (class)¶
Plot style structure (has support for copy.copy)
| Attribute | C++ | |
|---|---|---|
plot_default_size: ImVec2 | ImVec2 PlotDefaultSize; | = 400,300 default size used when ImVec2(0,0) is passed to BeginPlot |
plot_min_size: ImVec2 | ImVec2 PlotMinSize; | = 200,150 minimum size plot frame can be when shrunk |
plot_border_size: float | float PlotBorderSize; | = 1, line thickness of border around plot area |
minor_alpha: float | float MinorAlpha; | = 0.25 alpha multiplier applied to minor axis grid lines |
major_tick_len: ImVec2 | ImVec2 MajorTickLen; | = 10,10 major tick lengths for X and Y axes |
minor_tick_len: ImVec2 | ImVec2 MinorTickLen; | = 5,5 minor tick lengths for X and Y axes |
major_tick_size: ImVec2 | ImVec2 MajorTickSize; | = 1,1 line thickness of major ticks |
minor_tick_size: ImVec2 | ImVec2 MinorTickSize; | = 1,1 line thickness of minor ticks |
major_grid_size: ImVec2 | ImVec2 MajorGridSize; | = 1,1 line thickness of major grid lines |
minor_grid_size: ImVec2 | ImVec2 MinorGridSize; | = 1,1 line thickness of minor grid lines |
plot_padding: ImVec2 | ImVec2 PlotPadding; | = 10,10 padding between widget frame and plot area, labels, or outside legends (i.e. main padding) |
label_padding: ImVec2 | ImVec2 LabelPadding; | = 5,5 padding between axes labels, tick labels, and plot edge |
legend_padding: ImVec2 | ImVec2 LegendPadding; | = 10,10 legend padding from plot edges |
legend_inner_padding: ImVec2 | ImVec2 LegendInnerPadding; | = 5,5 legend inner padding from legend edges |
legend_spacing: ImVec2 | ImVec2 LegendSpacing; | = 5,0 spacing between legend entries |
mouse_pos_padding: ImVec2 | ImVec2 MousePosPadding; | = 10,10 padding between plot edge and interior mouse location text |
annotation_padding: ImVec2 | ImVec2 AnnotationPadding; | = 2,2 text padding around annotation labels |
fit_padding: ImVec2 | ImVec2 FitPadding; | = 0,0 additional fit padding as a percentage of the fit extents (e.g. ImVec2(0.1,0.1) adds 10% to the fit extents of X and Y) |
digital_padding: float | float DigitalPadding; | = 20, digital plot padding from bottom in pixels |
digital_spacing: float | float DigitalSpacing; | = 4, digital plot spacing gap in pixels |
colormap: Colormap | ImPlotColormap Colormap; | The current colormap. Set this to either an ImPlotColormap_ enum or an index returned by AddColormap. |
use_local_time: bool | bool UseLocalTime; | = False, axis labels will be formatted for your timezone when ImPlotAxisFlag_Time is enabled |
use_iso8601: bool | bool UseISO8601; | = False, dates will be formatted according to ISO 8601 where applicable (e.g. YYYY-MM-DD, YYYY-MM, --MM-DD, etc.) |
use24_hour_clock: bool | bool Use24HourClock; | = False, times will be formatted using a 24 hour clock |
Style.color_¶
def color_(self, idx_color: int) -> ImVec4inline IMPLOT_API ImVec4& Color_(size_t idxColor);Array of styling colors (index from implot.Col_.xxx)
Style.set_color_¶
def set_color_(self, idx_color: int, color: ImVec4Like) -> Noneinline IMPLOT_API void SetColor_(size_t idxColor, ImVec4 color);Array of styling colors (index from implot.Col_.xxx)
Style.__init__¶
def __init__(self) -> NoneIMPLOT_API ImPlotStyle();Support for legacy versions¶
InputMap (class)¶
Input mapping structure. Default values listed. See also MapInputDefault, MapInputReverse.
| Attribute | C++ | |
|---|---|---|
pan: MouseButton | ImGuiMouseButton Pan; | LMB enables panning when held, |
pan_mod: int | int PanMod; | none optional modifier that must be held for panning/fitting |
fit: MouseButton | ImGuiMouseButton Fit; | LMB initiates fit when double clicked |
select: MouseButton | ImGuiMouseButton Select; | RMB begins box selection when pressed and confirms selection when released |
select_cancel: MouseButton | ImGuiMouseButton SelectCancel; | LMB cancels active box selection when pressed; cannot be same as Select |
select_mod: int | int SelectMod; | none optional modifier that must be held for box selection |
select_horz_mod: int | int SelectHorzMod; | Alt expands active box selection horizontally to plot edge when held |
select_vert_mod: int | int SelectVertMod; | Shift expands active box selection vertically to plot edge when held |
menu: MouseButton | ImGuiMouseButton Menu; | RMB opens context menus (if enabled) when clicked |
override_mod: int | int OverrideMod; | Ctrl when held, all input is ignored; used to enable axis/plots as DND sources |
zoom_mod: int | int ZoomMod; | none optional modifier that must be held for scroll wheel zooming |
zoom_rate: float | float ZoomRate; | 0.1 zoom rate for scroll (e.g. 0.1 = 10% plot range every scroll click); make negative to invert |
InputMap.__init__¶
def __init__(self) -> NoneIMPLOT_API ImPlotInputMap();Contexts¶
create_context¶
def create_context() -> ContextIMPLOT_API ImPlotContext* CreateContext();Creates a new ImPlot context. Call this after ImGui::CreateContext.
destroy_context¶
def destroy_context(ctx: Optional[Context] = None) -> NoneIMPLOT_API void DestroyContext(ImPlotContext* ctx = nullptr);Destroys an ImPlot context. Call this before ImGui::DestroyContext. None = destroy current context.
get_current_context¶
def get_current_context() -> ContextIMPLOT_API ImPlotContext* GetCurrentContext();Returns the current ImPlot context. None if no context has ben set.
set_current_context¶
def set_current_context(ctx: Context) -> NoneIMPLOT_API void SetCurrentContext(ImPlotContext* ctx);Sets the current ImPlot context.
set_imgui_context¶
def set_imgui_context(ctx: ImGui_Context) -> NoneIMPLOT_API void SetImGuiContext(ImGuiContext* ctx);Sets the current ImGui context. This is ONLY necessary if you are compiling
ImPlot as a DLL (not recommended) separate from your ImGui compilation. It
sets the global variable GImGui, which is not shared across DLL boundaries.
See GImGui documentation in imgui.cpp for more details.
Begin/End Plot¶
begin_plot¶
def begin_plot(title_id: str, size: Optional[ImVec2Like] = None, flags: Flags = 0) -> boolIMPLOT_API bool BeginPlot(const char* title_id, const ImVec2& size=ImVec2(-1,0), ImPlotFlags flags=0);Starts a 2D plotting context. If this function returns True, EndPlot() MUST be called! You are encouraged to use the following convention:
if (BeginPlot(...)) {
PlotLine(...);
...
EndPlot();
}Important notes:
#title_id must be unique to the current ImGui ID scope. If you need to avoid ID collisions or don’t want to display a title in the plot, use double hashes (e.g. “MyPlot##HiddenIdText” or “##NoTitle”).
#size is the frame size of the plot widget, not the plot area. The default size of plots (i.e. when ImVec2(0,0)) can be modified in your ImPlotStyle.
Python bindings defaults:
If size is None, then its default value will be: ImVec2(-1,0)
end_plot¶
def end_plot() -> NoneIMPLOT_API void EndPlot();Only call EndPlot() if BeginPlot() returns True! Typically called at the end of an if statement conditioned on BeginPlot(). See example above.
Begin/End Subplots¶
SubplotsRowColRatios (class)¶
| Attribute | C++ | |
|---|---|---|
row_ratios: List[float] | std::vector<float> row_ratios; | |
col_ratios: List[float] | std::vector<float> col_ratios; |
SubplotsRowColRatios.__init__¶
def __init__(self, row_ratios: Optional[List[float]] = None, col_ratios: Optional[List[float]] = None) -> NoneAuto-generated default constructor with named params
Python bindings defaults:
If any of the params below is None, then its default value below will be used:
* row_ratios: Listfloat
* col_ratios: Listfloat
begin_subplots¶
def begin_subplots(title_id: str, rows: int, cols: int, size: ImVec2Like, flags: SubplotFlags = 0, row_col_ratios: Optional[SubplotsRowColRatios] = None) -> boolIMPLOT_API inline bool BeginSubplotsWithRatios(const char* title_id, int rows, int cols, const ImVec2& size, ImPlotSubplotFlags flags = 0, SubplotsRowColRatios* row_col_ratios = nullptr);end_subplots¶
def end_subplots() -> NoneIMPLOT_API void EndSubplots();Only call EndSubplots() if BeginSubplots() returns True! Typically called at the end of an if statement conditioned on BeginSubplots(). See example above.
Setup¶
setup_axis¶
def setup_axis(axis: ImAxis, label: Optional[str] = None, flags: AxisFlags = 0) -> NoneIMPLOT_API void SetupAxis(ImAxis axis, const char* label=nullptr, ImPlotAxisFlags flags=0);Enables an axis or sets the label and/or flags for an existing axis. Leave #label = None for no label.
The following API allows you to setup and customize various aspects of the current plot. The functions should be called immediately after BeginPlot and before any other API calls. Typical usage is as follows:
if (BeginPlot(...)) { 1) begin a new plot
SetupAxis(ImAxis_X1, "My X-Axis"); 2) make Setup calls
SetupAxis(ImAxis_Y1, "My Y-Axis");
SetupLegend(ImPlotLocation_North);
...
SetupFinish(); 3) [optional] explicitly finish setup
PlotLine(...); 4) plot items
...
EndPlot(); 5) end the plot
}Important notes:
Always call Setup code at the top of your BeginPlot conditional statement.
Setup is locked once you start plotting or explicitly call SetupFinish.
Do NOT call Setup code after you begin plotting or after you make any non-Setup API calls (e.g. utils like PlotToPixels also lock Setup)Calling SetupFinish is OPTIONAL, but probably good practice. If you do not call it yourself, then the first subsequent plotting or utility function will call it for you.
setup_axis_limits¶
def setup_axis_limits(axis: ImAxis, v_min: float, v_max: float, cond: Optional[Cond] = None) -> NoneIMPLOT_API void SetupAxisLimits(ImAxis axis, double v_min, double v_max, ImPlotCond cond = ImPlotCond_Once);Sets an axis range limits. If ImPlotCond_Always is used, the axes limits will be locked. Inversion with v_min > v_max is not supported; use SetupAxisLimits instead.
Python bindings defaults:
If cond is None, then its default value will be: Cond_Once
setup_axis_links¶
def setup_axis_links(axis: ImAxis, link_min: BoxedValue, link_max: BoxedValue) -> NoneIMPLOT_API inline void SetupAxisLinks(ImAxis axis, BoxedValue* link_min, BoxedValue* link_max);Links an axis range limits to external values. Use BoxedValue to transmit values (which will be updated after EndPlot).
setup_axis_format¶
def setup_axis_format(axis: ImAxis, fmt: str) -> NoneIMPLOT_API void SetupAxisFormat(ImAxis axis, const char* fmt);Sets the format of numeric axis labels via formatter specifier (default=“%g”). Formatted values will be double (i.e. use %f).
setup_axis_scale¶
def setup_axis_scale(axis: ImAxis, scale: Scale) -> NoneIMPLOT_API void SetupAxisScale(ImAxis axis, ImPlotScale scale);Sets an axis’ scale using built-in options.
setup_axis_limits_constraints¶
def setup_axis_limits_constraints(axis: ImAxis, v_min: float, v_max: float) -> NoneIMPLOT_API void SetupAxisLimitsConstraints(ImAxis axis, double v_min, double v_max);Sets an axis’ limits constraints.
setup_axis_zoom_constraints¶
def setup_axis_zoom_constraints(axis: ImAxis, z_min: float, z_max: float) -> NoneIMPLOT_API void SetupAxisZoomConstraints(ImAxis axis, double z_min, double z_max);Sets an axis’ zoom constraints.
setup_axes¶
def setup_axes(x_label: str, y_label: str, x_flags: AxisFlags = 0, y_flags: AxisFlags = 0) -> NoneIMPLOT_API void SetupAxes(const char* x_label, const char* y_label, ImPlotAxisFlags x_flags=0, ImPlotAxisFlags y_flags=0);Sets the label and/or flags for primary X and Y axes (shorthand for two calls to SetupAxis).
setup_axes_limits¶
def setup_axes_limits(x_min: float, x_max: float, y_min: float, y_max: float, cond: Optional[Cond] = None) -> NoneIMPLOT_API void SetupAxesLimits(double x_min, double x_max, double y_min, double y_max, ImPlotCond cond = ImPlotCond_Once);Sets the primary X and Y axes range limits. If ImPlotCond_Always is used, the axes limits will be locked (shorthand for two calls to SetupAxisLimits).
Python bindings defaults:
If cond is None, then its default value will be: Cond_Once
setup_legend¶
def setup_legend(location: Location, flags: LegendFlags = 0) -> NoneIMPLOT_API void SetupLegend(ImPlotLocation location, ImPlotLegendFlags flags=0);Sets up the plot legend. This can also be called immediately after BeginSubplots when using ImPlotSubplotFlags_ShareItems.
setup_mouse_text¶
def setup_mouse_text(location: Location, flags: MouseTextFlags = 0) -> NoneIMPLOT_API void SetupMouseText(ImPlotLocation location, ImPlotMouseTextFlags flags=0);Set the location of the current plot’s mouse position text (default = South|East).
setup_finish¶
def setup_finish() -> NoneIMPLOT_API void SetupFinish();Explicitly finalize plot setup. Once you call this, you cannot make anymore Setup calls for the current plot!
Note that calling this function is OPTIONAL; it will be called by the first subsequent setup-locking API call.
SetNext¶
set_next_axis_limits¶
def set_next_axis_limits(axis: ImAxis, v_min: float, v_max: float, cond: Optional[Cond] = None) -> NoneIMPLOT_API void SetNextAxisLimits(ImAxis axis, double v_min, double v_max, ImPlotCond cond = ImPlotCond_Once);Sets an upcoming axis range limits. If ImPlotCond_Always is used, the axes limits will be locked.
Though you should default to the Setup API above, there are some scenarios
where (re)configuring a plot or axis before BeginPlot is needed (e.g. if
using a preceding button or slider widget to change the plot limits). In
this case, you can use the SetNext API below. While this is not as feature
rich as the Setup API, most common needs are provided. These functions can be
called anywhere except for inside of Begin/EndPlot. For example:
if (ImGui::Button(“Center Plot”))
ImPlot::SetNextPlotLimits(-1,1,-1,1);
if (ImPlot::BeginPlot(...)) {
...
ImPlot::EndPlot();
}Important notes:
You must still enable non-default axes with SetupAxis for these functions to work properly.
Python bindings defaults:
If cond is None, then its default value will be: Cond_Once
set_next_axis_links¶
def set_next_axis_links(axis: ImAxis, link_min: BoxedValue, link_max: BoxedValue) -> NoneIMPLOT_API inline void SetNextAxisLinks(ImAxis axis, BoxedValue* link_min, BoxedValue* link_max);Links an upcoming axis range limits to external values. Use BoxedValue to transmit values (which will be updated after EndPlot).
set_next_axis_to_fit¶
def set_next_axis_to_fit(axis: ImAxis) -> NoneIMPLOT_API void SetNextAxisToFit(ImAxis axis);Set an upcoming axis to auto fit to its data.
set_next_axes_limits¶
def set_next_axes_limits(x_min: float, x_max: float, y_min: float, y_max: float, cond: Optional[Cond] = None) -> NoneIMPLOT_API void SetNextAxesLimits(double x_min, double x_max, double y_min, double y_max, ImPlotCond cond = ImPlotCond_Once);Sets the upcoming primary X and Y axes range limits. If ImPlotCond_Always is used, the axes limits will be locked (shorthand for two calls to SetupAxisLimits).
Python bindings defaults:
If cond is None, then its default value will be: Cond_Once
set_next_axes_to_fit¶
def set_next_axes_to_fit() -> NoneIMPLOT_API void SetNextAxesToFit();Sets all upcoming axes to auto fit to their data.
Plot Items¶
plot_line¶
@overload
def plot_line(label_id: str, values: np.ndarray, xscale: float = 1, xstart: float = 0, spec: Optional[Spec] = None) -> None
@overload
def plot_line(label_id: str, xs: np.ndarray, ys: np.ndarray, spec: Optional[Spec] = None) -> NoneIMPLOT_TMP void PlotLine(const char* label_id, const T* values, int count, double xscale=1, double xstart=0, const ImPlotSpec& spec=ImPlotSpec());
IMPLOT_TMP void PlotLine(const char* label_id, const T* xs, const T* ys, int count, const ImPlotSpec& spec=ImPlotSpec());The main plotting API is provided below. Call these functions between
Begin/EndPlot and after any Setup API calls. Each plots data on the current
x and y axes, which can be changed with SetAxis/Axes.
The templated functions are explicitly instantiated in implot_items.cpp.
They are not intended to be used generically with custom types. You will get
a linker error if you try! All functions support the following scalar types:
float, double, ImS8, ImU8, ImS16, ImU16, ImS32, ImU32, ImS64, ImU64
If you need to plot custom or non-homogenous data you have a few options:
If your data is a simple struct/class (e.g. Vector2f), you can use striding in your ImPlotSpec.
This is the most performant option if applicable.
struct Vector2f { float X, Y; };
...
Vector2f data[42];
ImPlot::PlotLine("line", &data[0].x, &data[0].y, 42, {ImPlotProp_Stride, sizeof(Vector2f});Write a custom getter C function or C++ lambda and pass it and optionally your data to an ImPlot function post-fixed with a G (e.g. PlotScatterG). This has a slight performance cost, but probably not enough to worry about unless your data is very large. Examples:
ImPlotPoint MyDataGetter(int idx, None* data) {
MyData* my_data = (MyData*)data;
ImPlotPoint p;
p.x = my_data->GetTime(idx);
p.y = my_data->GetValue(idx); return p }
...
auto my_lambda = [](int idx, None*) {
double t = idx / 999.0;
return ImPlotPoint(t, 0.5+0.5*std::sin(2*PI*10*t));
};
...
if (ImPlot::BeginPlot("MyPlot")) {
MyData my_data;
ImPlot::PlotScatterG("scatter", MyDataGetter, &my_data, my_data.Size());
ImPlot::PlotLineG("line", my_lambda, None, 1000);
ImPlot::EndPlot();
}NB: All types are converted to double before plotting. You may lose information
if you try plotting extremely large 64-bit integral types. Proceed with caution!
Plots a standard 2D line plot.
Python bindings defaults:
If spec is None, then its default value will be: Spec()
plot_scatter¶
@overload
def plot_scatter(label_id: str, values: np.ndarray, xscale: float = 1, xstart: float = 0, spec: Optional[Spec] = None) -> None
@overload
def plot_scatter(label_id: str, xs: np.ndarray, ys: np.ndarray, spec: Optional[Spec] = None) -> NoneIMPLOT_TMP void PlotScatter(const char* label_id, const T* values, int count, double xscale=1, double xstart=0, const ImPlotSpec& spec=ImPlotSpec());
IMPLOT_TMP void PlotScatter(const char* label_id, const T* xs, const T* ys, int count, const ImPlotSpec& spec=ImPlotSpec());Plots a standard 2D scatter plot. Default marker is ImPlotMarker_Circle.
Python bindings defaults:
If spec is None, then its default value will be: Spec()
plot_bubbles¶
@overload
def plot_bubbles(label_id: str, values: np.ndarray, szs: np.ndarray, xscale: float = 1, xstart: float = 0, spec: Optional[Spec] = None) -> None
@overload
def plot_bubbles(label_id: str, xs: np.ndarray, ys: np.ndarray, szs: np.ndarray, spec: Optional[Spec] = None) -> NoneIMPLOT_TMP void PlotBubbles(const char* label_id, const T* values, const T* szs, int count, double xscale=1, double xstart=0, const ImPlotSpec& spec=ImPlotSpec());
IMPLOT_TMP void PlotBubbles(const char* label_id, const T* xs, const T* ys, const T* szs, int count, const ImPlotSpec& spec=ImPlotSpec());Note: all array arguments must share the same dtype (e.g. xs = xs.astype(ys.dtype)).
Plots a bubble graph. #szs are the radius of each bubble in plot units.
Python bindings defaults:
If spec is None, then its default value will be: Spec()
plot_polygon¶
def plot_polygon(label_id: str, xs: np.ndarray, ys: np.ndarray, spec: Optional[Spec] = None) -> NoneIMPLOT_TMP void PlotPolygon(const char* label_id, const T* xs, const T* ys, int count, const ImPlotSpec& spec=ImPlotSpec());Plots a polygon. Points are specified in counter-clockwise order. If concave, make sure to set the Concave flag.
Note: all array arguments must share the same dtype (e.g. xs = xs.astype(ys.dtype)).
Python bindings defaults:
If spec is None, then its default value will be: Spec()
plot_stairs¶
@overload
def plot_stairs(label_id: str, values: np.ndarray, xscale: float = 1, xstart: float = 0, spec: Optional[Spec] = None) -> None
@overload
def plot_stairs(label_id: str, xs: np.ndarray, ys: np.ndarray, spec: Optional[Spec] = None) -> NoneIMPLOT_TMP void PlotStairs(const char* label_id, const T* values, int count, double xscale=1, double xstart=0, const ImPlotSpec& spec=ImPlotSpec());
IMPLOT_TMP void PlotStairs(const char* label_id, const T* xs, const T* ys, int count, const ImPlotSpec& spec=ImPlotSpec());Plots a a stairstep graph. The y value is continued constantly to the right from every x position, i.e. the interval [x[i], x[i+1]) has the value y[i]
Python bindings defaults:
If spec is None, then its default value will be: Spec()
plot_shaded¶
@overload
def plot_shaded(label_id: str, values: np.ndarray, yref: float = 0, xscale: float = 1, xstart: float = 0, spec: Optional[Spec] = None) -> None
@overload
def plot_shaded(label_id: str, xs: np.ndarray, ys: np.ndarray, yref: float = 0, spec: Optional[Spec] = None) -> None
@overload
def plot_shaded(label_id: str, xs: np.ndarray, ys1: np.ndarray, ys2: np.ndarray, spec: Optional[Spec] = None) -> NoneIMPLOT_TMP void PlotShaded(const char* label_id, const T* values, int count, double yref=0, double xscale=1, double xstart=0, const ImPlotSpec& spec=ImPlotSpec());
IMPLOT_TMP void PlotShaded(const char* label_id, const T* xs, const T* ys, int count, double yref=0, const ImPlotSpec& spec=ImPlotSpec());
IMPLOT_TMP void PlotShaded(const char* label_id, const T* xs, const T* ys1, const T* ys2, int count, const ImPlotSpec& spec=ImPlotSpec());Plots a shaded (filled) region between two lines, or a line and a horizontal reference. Set yref to +/-INFINITY for infinite fill extents.
Python bindings defaults:
If spec is None, then its default value will be: Spec()
plot_bars¶
@overload
def plot_bars(label_id: str, values: np.ndarray, bar_size: float = 0.67, shift: float = 0, spec: Optional[Spec] = None) -> None
@overload
def plot_bars(label_id: str, xs: np.ndarray, ys: np.ndarray, bar_size: float, spec: Optional[Spec] = None) -> NoneIMPLOT_TMP void PlotBars(const char* label_id, const T* values, int count, double bar_size=0.67, double shift=0, const ImPlotSpec& spec=ImPlotSpec());
IMPLOT_TMP void PlotBars(const char* label_id, const T* xs, const T* ys, int count, double bar_size, const ImPlotSpec& spec=ImPlotSpec());Plots a bar graph. Vertical by default. #bar_size and #shift are in plot units.
Python bindings defaults:
If spec is None, then its default value will be: Spec()
plot_bar_groups¶
def plot_bar_groups(label_ids: List[str], values: np.ndarray, group_size: float = 0.67, shift: float = 0, spec: Optional[Spec] = None) -> NoneIMPLOT_TMP void PlotBarGroups(const std::vector<std::string>& label_ids, const T* values, int count, double group_size=0.67, double shift=0, const ImPlotSpec& spec=ImPlotSpec());Plots a group of bars.
values should be a 1 dimension numpy array of values.
label_ids should be a list of strings corresponding to bars labels
Python bindings defaults:
If spec is None, then its default value will be: Spec()
plot_error_bars¶
@overload
def plot_error_bars(label_id: str, xs: np.ndarray, ys: np.ndarray, err: np.ndarray, spec: Optional[Spec] = None) -> None
@overload
def plot_error_bars(label_id: str, xs: np.ndarray, ys: np.ndarray, neg: np.ndarray, pos: np.ndarray, spec: Optional[Spec] = None) -> NoneIMPLOT_TMP void PlotErrorBars(const char* label_id, const T* xs, const T* ys, const T* err, int count, const ImPlotSpec& spec=ImPlotSpec());
IMPLOT_TMP void PlotErrorBars(const char* label_id, const T* xs, const T* ys, const T* neg, const T* pos, int count, const ImPlotSpec& spec=ImPlotSpec());Note: all array arguments must share the same dtype (e.g. xs = xs.astype(ys.dtype)).
Plots vertical error bar. The label_id should be the same as the label_id of the associated line or bar plot.
Python bindings defaults:
If spec is None, then its default value will be: Spec()
plot_stems¶
@overload
def plot_stems(label_id: str, values: np.ndarray, ref: float = 0, scale: float = 1, start: float = 0, spec: Optional[Spec] = None) -> None
@overload
def plot_stems(label_id: str, xs: np.ndarray, ys: np.ndarray, ref: float = 0, spec: Optional[Spec] = None) -> NoneIMPLOT_TMP void PlotStems(const char* label_id, const T* values, int count, double ref=0, double scale=1, double start=0, const ImPlotSpec& spec=ImPlotSpec());
IMPLOT_TMP void PlotStems(const char* label_id, const T* xs, const T* ys, int count, double ref=0, const ImPlotSpec& spec=ImPlotSpec());Plots stems. Vertical by default.
Python bindings defaults:
If spec is None, then its default value will be: Spec()
plot_inf_lines¶
def plot_inf_lines(label_id: str, values: np.ndarray, spec: Optional[Spec] = None) -> NoneIMPLOT_TMP void PlotInfLines(const char* label_id, const T* values, int count, const ImPlotSpec& spec=ImPlotSpec());Plots infinite vertical or horizontal lines (e.g. for references or asymptotes).
Python bindings defaults:
If spec is None, then its default value will be: Spec()
plot_pie_chart¶
def plot_pie_chart(label_ids: List[str], values: np.ndarray, x: float, y: float, radius: float, label_fmt: str = '%.1f', angle0: float = 90, spec: Optional[Spec] = None) -> NoneIMPLOT_TMP void PlotPieChart(const char* const label_ids[], const T* values, int count, double x, double y, double radius, const char* label_fmt="%.1f", double angle0=90, const ImPlotSpec& spec=ImPlotSpec());Plots a pie chart. Center and radius are in plot units. #label_fmt can be set to None for no labels.
Python bindings defaults:
If spec is None, then its default value will be: Spec()
plot_histogram¶
def plot_histogram(label_id: str, values: np.ndarray, bins: int = Bin_Sturges, bar_scale: float = 1.0, range: Optional[Range] = None, spec: Optional[Spec] = None) -> floatIMPLOT_TMP double PlotHistogram(const char* label_id, const T* values, int count, int bins=ImPlotBin_Sturges, double bar_scale=1.0, ImPlotRange range=ImPlotRange(), const ImPlotSpec& spec=ImPlotSpec());Plots a horizontal histogram. #bins can be a positive integer or an ImPlotBin_ method. If #range is left unspecified, the min/max of #values will be used as the range.
Otherwise, outlier values outside of the range are not binned. The largest bin count or density is returned.
Python bindings defaults:
If any of the params below is None, then its default value below will be used:
* range: Range()
* spec: Spec()
plot_histogram_2d¶
def plot_histogram_2d(label_id: str, xs: np.ndarray, ys: np.ndarray, x_bins: int = Bin_Sturges, y_bins: int = Bin_Sturges, range: Optional[Rect] = None, spec: Optional[Spec] = None) -> floatIMPLOT_TMP double PlotHistogram2D(const char* label_id, const T* xs, const T* ys, int count, int x_bins=ImPlotBin_Sturges, int y_bins=ImPlotBin_Sturges, ImPlotRect range=ImPlotRect(), const ImPlotSpec& spec=ImPlotSpec());Plots two dimensional, bivariate histogram as a heatmap. #x_bins and #y_bins can be a positive integer or an ImPlotBin. If #range is left unspecified, the min/max of
#xs an #ys will be used as the ranges. Otherwise, outlier values outside of range are not binned. The largest bin count or density is returned.
Note: all array arguments must share the same dtype (e.g. xs = xs.astype(ys.dtype)).
Python bindings defaults:
If any of the params below is None, then its default value below will be used:
* range: Rect()
* spec: Spec()
plot_digital¶
def plot_digital(label_id: str, xs: np.ndarray, ys: np.ndarray, spec: Optional[Spec] = None) -> NoneIMPLOT_TMP void PlotDigital(const char* label_id, const T* xs, const T* ys, int count, const ImPlotSpec& spec=ImPlotSpec());Note: all array arguments must share the same dtype (e.g. xs = xs.astype(ys.dtype)).
Plots digital data. Digital plots do not respond to y drag or zoom, and are always referenced to the bottom of the plot.
Python bindings defaults:
If spec is None, then its default value will be: Spec()
plot_image¶
def plot_image(label_id: str, tex_ref: ImTextureRef, bounds_min: Point, bounds_max: Point, uv0: Optional[ImVec2Like] = None, uv1: Optional[ImVec2Like] = None, tint_col: Optional[ImVec4Like] = None, spec: Optional[Spec] = None) -> NoneIMPLOT_API void PlotImage(const char* label_id, ImTextureRef tex_ref, const ImPlotPoint& bounds_min, const ImPlotPoint& bounds_max, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), const ImVec4& tint_col = ImVec4(1, 1, 1, 1), const ImPlotSpec& spec=ImPlotSpec());Plots an axis-aligned image. #bounds_min/bounds_max are in plot coordinates (y-up) and #uv0/uv1 are in texture coordinates (y-down).
Python bindings defaults:
If any of the params below is None, then its default value below will be used:
* uv0: ImVec2(0, 0)
* uv1: ImVec2(1, 1)
* tint_col: ImVec4(1, 1, 1, 1)
* spec: Spec()
plot_text¶
def plot_text(text: str, x: float, y: float, pix_offset: Optional[ImVec2Like] = None, spec: Optional[Spec] = None) -> NoneIMPLOT_API void PlotText(const char* text, double x, double y, const ImVec2& pix_offset=ImVec2(0,0), const ImPlotSpec& spec=ImPlotSpec());Plots a centered text label at point x,y with an optional pixel offset. Text color can be changed with ImPlot::PushStyleColor(ImPlotCol_InlayText, ...).
Python bindings defaults:
If any of the params below is None, then its default value below will be used:
* pix_offset: ImVec2(0,0)
* spec: Spec()
plot_dummy¶
def plot_dummy(label_id: str, spec: Optional[Spec] = None) -> NoneIMPLOT_API void PlotDummy(const char* label_id, const ImPlotSpec& spec=ImPlotSpec());Plots a dummy item (i.e. adds a legend entry colored by ImPlotCol_Line)
Python bindings defaults:
If spec is None, then its default value will be: Spec()
Plot Tools¶
drag_point¶
def drag_point(id_: int, x: float, y: float, col: ImVec4Like, size: float = 4, flags: DragToolFlags = 0, out_clicked: Optional[bool] = None, out_hovered: Optional[bool] = None, out_held: Optional[bool] = None) -> Tuple[bool, float, float, Optional[bool], Optional[bool], Optional[bool]]IMPLOT_API bool DragPoint(int id, double* x, double* y, const ImVec4& col, float size = 4, ImPlotDragToolFlags flags = 0, bool* out_clicked = nullptr, bool* out_hovered = nullptr, bool* out_held = nullptr);Shows a draggable point at x,y. #col defaults to ImGuiCol_Text.
The following can be used to render interactive elements and/or annotations.
Like the item plotting functions above, they apply to the current x and y
axes, which can be changed with SetAxis/SetAxes. These functions return True
when user interaction causes the provided coordinates to change. Additional
user interactions can be retrieved through the optional output parameters.
drag_line_x¶
def drag_line_x(id_: int, x: float, col: ImVec4Like, thickness: float = 1, flags: DragToolFlags = 0, out_clicked: Optional[bool] = None, out_hovered: Optional[bool] = None, out_held: Optional[bool] = None) -> Tuple[bool, float, Optional[bool], Optional[bool], Optional[bool]]IMPLOT_API bool DragLineX(int id, double* x, const ImVec4& col, float thickness = 1, ImPlotDragToolFlags flags = 0, bool* out_clicked = nullptr, bool* out_hovered = nullptr, bool* out_held = nullptr);Shows a draggable vertical guide line at an x-value. #col defaults to ImGuiCol_Text.
drag_line_y¶
def drag_line_y(id_: int, y: float, col: ImVec4Like, thickness: float = 1, flags: DragToolFlags = 0, out_clicked: Optional[bool] = None, out_hovered: Optional[bool] = None, out_held: Optional[bool] = None) -> Tuple[bool, float, Optional[bool], Optional[bool], Optional[bool]]IMPLOT_API bool DragLineY(int id, double* y, const ImVec4& col, float thickness = 1, ImPlotDragToolFlags flags = 0, bool* out_clicked = nullptr, bool* out_hovered = nullptr, bool* out_held = nullptr);Shows a draggable horizontal guide line at a y-value. #col defaults to ImGuiCol_Text.
drag_rect¶
def drag_rect(id_: int, x1: float, y1: float, x2: float, y2: float, col: ImVec4Like, flags: DragToolFlags = 0, out_clicked: Optional[bool] = None, out_hovered: Optional[bool] = None, out_held: Optional[bool] = None) -> Tuple[bool, float, float, float, float, Optional[bool], Optional[bool], Optional[bool]]IMPLOT_API bool DragRect(int id, double* x1, double* y1, double* x2, double* y2, const ImVec4& col, ImPlotDragToolFlags flags = 0, bool* out_clicked = nullptr, bool* out_hovered = nullptr, bool* out_held = nullptr);Shows a draggable and resizeable rectangle.
annotation¶
@overload
def annotation(x: float, y: float, col: ImVec4Like, pix_offset: ImVec2Like, clamp: bool, round: bool = False) -> None
@overload
def annotation(x: float, y: float, col: ImVec4Like, pix_offset: ImVec2Like, clamp: bool, fmt: str) -> NoneIMPLOT_API void Annotation(double x, double y, const ImVec4& col, const ImVec2& pix_offset, bool clamp, bool round = false);
IMPLOT_API void Annotation(double x, double y, const ImVec4& col, const ImVec2& pix_offset, bool clamp, const char* fmt, ...) ;Shows an annotation callout at a chosen point. Clamping keeps annotations in the plot area. Annotations are always rendered on top.
tag_x¶
@overload
def tag_x(x: float, col: ImVec4Like, round: bool = False) -> None
@overload
def tag_x(x: float, col: ImVec4Like, fmt: str) -> NoneIMPLOT_API void TagX(double x, const ImVec4& col, bool round = false);
IMPLOT_API void TagX(double x, const ImVec4& col, const char* fmt, ...) ;Shows a x-axis tag at the specified coordinate value.
tag_y¶
@overload
def tag_y(y: float, col: ImVec4Like, round: bool = False) -> None
@overload
def tag_y(y: float, col: ImVec4Like, fmt: str) -> NoneIMPLOT_API void TagY(double y, const ImVec4& col, bool round = false);
IMPLOT_API void TagY(double y, const ImVec4& col, const char* fmt, ...) ;Shows a y-axis tag at the specified coordinate value.
Plot Utils¶
set_axis¶
def set_axis(axis: ImAxis) -> NoneIMPLOT_API void SetAxis(ImAxis axis);Select which axis/axes will be used for subsequent plot elements.
set_axes¶
def set_axes(x_axis: ImAxis, y_axis: ImAxis) -> NoneIMPLOT_API void SetAxes(ImAxis x_axis, ImAxis y_axis);pixels_to_plot¶
@overload
def pixels_to_plot(pix: ImVec2Like, x_axis: Optional[ImAxis] = None, y_axis: Optional[ImAxis] = None) -> Point
@overload
def pixels_to_plot(x: float, y: float, x_axis: Optional[ImAxis] = None, y_axis: Optional[ImAxis] = None) -> PointIMPLOT_API ImPlotPoint PixelsToPlot(const ImVec2& pix, ImAxis x_axis = IMPLOT_AUTO, ImAxis y_axis = IMPLOT_AUTO);
IMPLOT_API ImPlotPoint PixelsToPlot(float x, float y, ImAxis x_axis = IMPLOT_AUTO, ImAxis y_axis = IMPLOT_AUTO);Convert pixels to a position in the current plot’s coordinate system. Passing IMPLOT_AUTO uses the current axes.
Python bindings defaults:
If any of the params below is None, then its default value below will be used:
* x_axis: IMPLOT_AUTO
* y_axis: IMPLOT_AUTO
plot_to_pixels¶
@overload
def plot_to_pixels(plt: Point, x_axis: Optional[ImAxis] = None, y_axis: Optional[ImAxis] = None) -> ImVec2
@overload
def plot_to_pixels(x: float, y: float, x_axis: Optional[ImAxis] = None, y_axis: Optional[ImAxis] = None) -> ImVec2IMPLOT_API ImVec2 PlotToPixels(const ImPlotPoint& plt, ImAxis x_axis = IMPLOT_AUTO, ImAxis y_axis = IMPLOT_AUTO);
IMPLOT_API ImVec2 PlotToPixels(double x, double y, ImAxis x_axis = IMPLOT_AUTO, ImAxis y_axis = IMPLOT_AUTO);Convert a position in the current plot’s coordinate system to pixels. Passing IMPLOT_AUTO uses the current axes.
Python bindings defaults:
If any of the params below is None, then its default value below will be used:
* x_axis: IMPLOT_AUTO
* y_axis: IMPLOT_AUTO
get_plot_pos¶
def get_plot_pos() -> ImVec2IMPLOT_API ImVec2 GetPlotPos();Get the current Plot position (top-left) in pixels.
get_plot_size¶
def get_plot_size() -> ImVec2IMPLOT_API ImVec2 GetPlotSize();Get the current Plot size in pixels.
get_plot_mouse_pos¶
def get_plot_mouse_pos(x_axis: Optional[ImAxis] = None, y_axis: Optional[ImAxis] = None) -> PointIMPLOT_API ImPlotPoint GetPlotMousePos(ImAxis x_axis = IMPLOT_AUTO, ImAxis y_axis = IMPLOT_AUTO);Returns the mouse position in x,y coordinates of the current plot. Passing IMPLOT_AUTO uses the current axes.
Python bindings defaults:
If any of the params below is None, then its default value below will be used:
* x_axis: IMPLOT_AUTO
* y_axis: IMPLOT_AUTO
get_plot_limits¶
def get_plot_limits(x_axis: Optional[ImAxis] = None, y_axis: Optional[ImAxis] = None) -> RectIMPLOT_API ImPlotRect GetPlotLimits(ImAxis x_axis = IMPLOT_AUTO, ImAxis y_axis = IMPLOT_AUTO);Returns the current plot axis range.
Python bindings defaults:
If any of the params below is None, then its default value below will be used:
* x_axis: IMPLOT_AUTO
* y_axis: IMPLOT_AUTO
is_plot_hovered¶
def is_plot_hovered() -> boolIMPLOT_API bool IsPlotHovered();Returns True if the plot area in the current plot is hovered.
is_axis_hovered¶
def is_axis_hovered(axis: ImAxis) -> boolIMPLOT_API bool IsAxisHovered(ImAxis axis);Returns True if the axis label area in the current plot is hovered.
is_subplots_hovered¶
def is_subplots_hovered() -> boolIMPLOT_API bool IsSubplotsHovered();Returns True if the bounding frame of a subplot is hovered.
is_plot_selected¶
def is_plot_selected() -> boolIMPLOT_API bool IsPlotSelected();Returns True if the current plot is being box selected.
get_plot_selection¶
def get_plot_selection(x_axis: Optional[ImAxis] = None, y_axis: Optional[ImAxis] = None) -> RectIMPLOT_API ImPlotRect GetPlotSelection(ImAxis x_axis = IMPLOT_AUTO, ImAxis y_axis = IMPLOT_AUTO);Returns the current plot box selection bounds. Passing IMPLOT_AUTO uses the current axes.
Python bindings defaults:
If any of the params below is None, then its default value below will be used:
* x_axis: IMPLOT_AUTO
* y_axis: IMPLOT_AUTO
cancel_plot_selection¶
def cancel_plot_selection() -> NoneIMPLOT_API void CancelPlotSelection();Cancels a the current plot box selection.
hide_next_item¶
def hide_next_item(hidden: bool = True, cond: Optional[Cond] = None) -> NoneIMPLOT_API void HideNextItem(bool hidden = true, ImPlotCond cond = ImPlotCond_Once);Hides or shows the next plot item (i.e. as if it were toggled from the legend).
Use ImPlotCond_Always if you need to forcefully set this every frame.
Python bindings defaults:
If cond is None, then its default value will be: Cond_Once
begin_aligned_plots¶
def begin_aligned_plots(group_id: str, vertical: bool = True) -> boolIMPLOT_API bool BeginAlignedPlots(const char* group_id, bool vertical = true);Align axis padding over multiple plots in a single row or column. #group_id must be unique. If this function returns True, EndAlignedPlots() must be called.
Use the following around calls to Begin/EndPlot to align l/r/t/b padding.
Consider using Begin/EndSubplots first. They are more feature rich and
accomplish the same behaviour by default. The functions below offer lower
level control of plot alignment.
end_aligned_plots¶
def end_aligned_plots() -> NoneIMPLOT_API void EndAlignedPlots();Only call EndAlignedPlots() if BeginAlignedPlots() returns True!
Legend Utils¶
begin_legend_popup¶
def begin_legend_popup(label_id: str, mouse_button: MouseButton = 1) -> boolIMPLOT_API bool BeginLegendPopup(const char* label_id, ImGuiMouseButton mouse_button=1);Begin a popup for a legend entry.
end_legend_popup¶
def end_legend_popup() -> NoneIMPLOT_API void EndLegendPopup();End a popup for a legend entry.
is_legend_entry_hovered¶
def is_legend_entry_hovered(label_id: str) -> boolIMPLOT_API bool IsLegendEntryHovered(const char* label_id);Returns True if a plot item legend entry is hovered.
Drag and Drop¶
begin_drag_drop_target_plot¶
def begin_drag_drop_target_plot() -> boolIMPLOT_API bool BeginDragDropTargetPlot();Turns the current plot’s plotting area into a drag and drop target. Don’t forget to call EndDragDropTarget!
begin_drag_drop_target_axis¶
def begin_drag_drop_target_axis(axis: ImAxis) -> boolIMPLOT_API bool BeginDragDropTargetAxis(ImAxis axis);Turns the current plot’s X-axis into a drag and drop target. Don’t forget to call EndDragDropTarget!
begin_drag_drop_target_legend¶
def begin_drag_drop_target_legend() -> boolIMPLOT_API bool BeginDragDropTargetLegend();Turns the current plot’s legend into a drag and drop target. Don’t forget to call EndDragDropTarget!
end_drag_drop_target¶
def end_drag_drop_target() -> NoneIMPLOT_API void EndDragDropTarget();Ends a drag and drop target (currently just an alias for ImGui::EndDragDropTarget).
begin_drag_drop_source_plot¶
def begin_drag_drop_source_plot(flags: DragDropFlags = 0) -> boolIMPLOT_API bool BeginDragDropSourcePlot(ImGuiDragDropFlags flags=0);Turns the current plot’s plotting area into a drag and drop source. You must hold Ctrl. Don’t forget to call EndDragDropSource!
NB: By default, plot and axes drag and drop sources require holding the Ctrl modifier to initiate the drag.
You can change the modifier if desired. If ImGuiMod_None is provided, the axes will be locked from panning.
begin_drag_drop_source_axis¶
def begin_drag_drop_source_axis(axis: ImAxis, flags: DragDropFlags = 0) -> boolIMPLOT_API bool BeginDragDropSourceAxis(ImAxis axis, ImGuiDragDropFlags flags=0);Turns the current plot’s X-axis into a drag and drop source. You must hold Ctrl. Don’t forget to call EndDragDropSource!
begin_drag_drop_source_item¶
def begin_drag_drop_source_item(label_id: str, flags: DragDropFlags = 0) -> boolIMPLOT_API bool BeginDragDropSourceItem(const char* label_id, ImGuiDragDropFlags flags=0);Turns an item in the current plot’s legend into drag and drop source. Don’t forget to call EndDragDropSource!
end_drag_drop_source¶
def end_drag_drop_source() -> NoneIMPLOT_API void EndDragDropSource();Ends a drag and drop source (currently just an alias for ImGui::EndDragDropSource).
Styling¶
get_style¶
def get_style() -> StyleIMPLOT_API ImPlotStyle& GetStyle();Styling colors in ImPlot works similarly to styling colors in ImGui, but
with one important difference. Like ImGui, all style colors are stored in an
indexable array in ImPlotStyle. You can permanently modify these values through
GetStyle().Colors, or temporarily modify them with Push/Pop functions below.
However, by default all style colors in ImPlot default to a special color
IMPLOT_AUTO_COL. IMPLOT_AUTO_COL tells ImPlot to set that color from color data
in your ImGuiStyle. The ImGuiCol_ that these style colors default to are
detailed above, and in general have been mapped to produce plots visually
consistent with your current ImGui style. Of course, you are free to
manually set these colors to whatever you like, and further can Push/Pop
them around individual plots for plot-specific styling (e.g. coloring axes).
Provides access to plot style structure for permanent modifications to colors, sizes, etc.
set_style¶
def set_style(style: Style) -> NoneIMPLOT_API void SetStyle(const ImPlotStyle& style);style_colors_auto¶
def style_colors_auto(dst: Optional[Style] = None) -> NoneIMPLOT_API void StyleColorsAuto(ImPlotStyle* dst = nullptr);Style plot colors for current ImGui style (default).
style_colors_classic¶
def style_colors_classic(dst: Optional[Style] = None) -> NoneIMPLOT_API void StyleColorsClassic(ImPlotStyle* dst = nullptr);Style plot colors for ImGui “Classic”.
style_colors_dark¶
def style_colors_dark(dst: Optional[Style] = None) -> NoneIMPLOT_API void StyleColorsDark(ImPlotStyle* dst = nullptr);Style plot colors for ImGui “Dark”.
style_colors_light¶
def style_colors_light(dst: Optional[Style] = None) -> NoneIMPLOT_API void StyleColorsLight(ImPlotStyle* dst = nullptr);Style plot colors for ImGui “Light”.
push_style_color¶
@overload
def push_style_color(idx: Col, col: ImU32) -> None
@overload
def push_style_color(idx: Col, col: ImVec4Like) -> NoneIMPLOT_API void PushStyleColor(ImPlotCol idx, ImU32 col);
IMPLOT_API void PushStyleColor(ImPlotCol idx, const ImVec4& col);Use PushStyleX to temporarily modify your ImPlotStyle. The modification
will last until the matching call to PopStyleX. You MUST call a pop for
every push, otherwise you will leak memory! This behaves just like ImGui.
Temporarily modify a style color. Don’t forget to call PopStyleColor!
pop_style_color¶
def pop_style_color(count: int = 1) -> NoneIMPLOT_API void PopStyleColor(int count = 1);Undo temporary style color modification(s). Undo multiple pushes at once by increasing count.
push_style_var¶
@overload
def push_style_var(idx: StyleVar, val: int) -> None
@overload
def push_style_var(idx: StyleVar, val: float) -> None
@overload
def push_style_var(idx: StyleVar, val: ImVec2Like) -> NoneIMPLOT_API void PushStyleVar(ImPlotStyleVar idx, int val);
IMPLOT_API void PushStyleVar(ImPlotStyleVar idx, float val);
IMPLOT_API void PushStyleVar(ImPlotStyleVar idx, const ImVec2& val);Temporarily modify a style variable of int type. Don’t forget to call PopStyleVar!
pop_style_var¶
def pop_style_var(count: int = 1) -> NoneIMPLOT_API void PopStyleVar(int count = 1);Undo temporary style variable modification(s). Undo multiple pushes at once by increasing count.
get_last_item_color¶
def get_last_item_color() -> ImVec4IMPLOT_API ImVec4 GetLastItemColor();Gets the last item primary color (i.e. its legend icon color)
get_style_color_name¶
def get_style_color_name(idx: Col) -> strIMPLOT_API const char* GetStyleColorName(ImPlotCol idx);Returns the null terminated string name for an ImPlotCol.
get_marker_name¶
def get_marker_name(idx: Marker) -> strIMPLOT_API const char* GetMarkerName(ImPlotMarker idx);Returns the null terminated string name for an ImPlotMarker.
next_marker¶
def next_marker() -> MarkerIMPLOT_API ImPlotMarker NextMarker();Returns the next marker and advances the marker for the current plot. You need to call this between Begin/EndPlot!
Colormaps¶
get_colormap_count¶
def get_colormap_count() -> intIMPLOT_API int GetColormapCount();Returns the number of available colormaps (i.e. the built-in + user-added count).
Item styling is based on colormaps when the relevant ImPlotCol_XXX is set to
IMPLOT_AUTO_COL (default). Several built-in colormaps are available. You can
add and then push/pop your own colormaps as well. To permanently set a colormap,
modify the Colormap index member of your ImPlotStyle.
Colormap data will be ignored and a custom color will be used if you have done one of the following:
1) Modified an item style color in your ImPlotStyle to anything other than IMPLOT_AUTO_COL.
2) Pushed an item style color using PushStyleColor().
3) Set the next item style with a SetNextXXXStyle function.
Add a new colormap. The color data will be copied. The colormap can be used by pushing either the returned index or the
string name with PushColormap. The colormap name must be unique and the size must be greater than 1. You will receive
an assert otherwise! By default colormaps are considered to be qualitative (i.e. discrete). If you want to create a
continuous colormap, set #qual=False. This will treat the colors you provide as keys, and ImPlot will build a linearly
interpolated lookup table. The memory footprint of this table will be exactly ((size-1)*255+1)*4 bytes.
get_colormap_name¶
def get_colormap_name(cmap: Colormap) -> strIMPLOT_API const char* GetColormapName(ImPlotColormap cmap);Returns a null terminated string name for a colormap given an index. Returns None if index is invalid.
get_colormap_index¶
def get_colormap_index(name: str) -> ColormapIMPLOT_API ImPlotColormap GetColormapIndex(const char* name);Returns an index number for a colormap given a valid string name. Returns -1 if name is invalid.
push_colormap¶
@overload
def push_colormap(cmap: Colormap) -> None
@overload
def push_colormap(name: str) -> NoneIMPLOT_API void PushColormap(ImPlotColormap cmap);
IMPLOT_API void PushColormap(const char* name);Temporarily switch to one of the built-in (i.e. ImPlotColormap_XXX) or user-added colormaps (i.e. a return value of AddColormap). Don’t forget to call PopColormap!
pop_colormap¶
def pop_colormap(count: int = 1) -> NoneIMPLOT_API void PopColormap(int count = 1);Undo temporary colormap modification(s). Undo multiple pushes at once by increasing count.
next_colormap_color¶
def next_colormap_color() -> ImVec4IMPLOT_API ImVec4 NextColormapColor();Returns the next color from the current colormap and advances the colormap for the current plot.
Can also be used with no return value to skip colors if desired. You need to call this between Begin/EndPlot!
get_colormap_size¶
def get_colormap_size(cmap: Optional[Colormap] = None) -> intIMPLOT_API int GetColormapSize(ImPlotColormap cmap = IMPLOT_AUTO);Returns the size of a colormap.
Colormap utils. If cmap = IMPLOT_AUTO (default), the current colormap is assumed.
Pass an explicit colormap index (built-in or user-added) to specify otherwise.
Python bindings defaults:
If cmap is None, then its default value will be: IMPLOT_AUTO
get_colormap_color¶
def get_colormap_color(idx: int, cmap: Optional[Colormap] = None) -> ImVec4IMPLOT_API ImVec4 GetColormapColor(int idx, ImPlotColormap cmap = IMPLOT_AUTO);Returns a color from a colormap given an index >= 0 (modulo will be performed).
Python bindings defaults:
If cmap is None, then its default value will be: IMPLOT_AUTO
sample_colormap¶
def sample_colormap(t: float, cmap: Optional[Colormap] = None) -> ImVec4IMPLOT_API ImVec4 SampleColormap(float t, ImPlotColormap cmap = IMPLOT_AUTO);Sample a color from the current colormap given t between 0 and 1.
Python bindings defaults:
If cmap is None, then its default value will be: IMPLOT_AUTO
colormap_scale¶
def colormap_scale(label: str, scale_min: float, scale_max: float, size: Optional[ImVec2Like] = None, format: str = '%g', flags: ColormapScaleFlags = 0, cmap: Optional[Colormap] = None) -> NoneIMPLOT_API void ColormapScale(const char* label, double scale_min, double scale_max, const ImVec2& size = ImVec2(0,0), const char* format = "%g", ImPlotColormapScaleFlags flags = 0, ImPlotColormap cmap = IMPLOT_AUTO);Shows a vertical color scale with linear spaced ticks using the specified color map. Use double hashes to hide label (e.g. “##NoLabel”). If scale_min > scale_max, the scale to color mapping will be reversed.
Python bindings defaults:
If any of the params below is None, then its default value below will be used:
* size: ImVec2(0,0)
* cmap: IMPLOT_AUTO
colormap_slider¶
def colormap_slider(label: str, t: float, out: Optional[ImVec4Like] = None, format: str = '', cmap: Optional[Colormap] = None) -> Tuple[bool, float]IMPLOT_API bool ColormapSlider(const char* label, float* t, ImVec4* out = nullptr, const char* format = "", ImPlotColormap cmap = IMPLOT_AUTO);Shows a horizontal slider with a colormap gradient background. Optionally returns the color sampled at t in [0 1].
Python bindings defaults:
If cmap is None, then its default value will be: IMPLOT_AUTO
colormap_button¶
def colormap_button(label: str, size: Optional[ImVec2Like] = None, cmap: Optional[Colormap] = None) -> boolIMPLOT_API bool ColormapButton(const char* label, const ImVec2& size = ImVec2(0,0), ImPlotColormap cmap = IMPLOT_AUTO);Shows a button with a colormap gradient background.
Python bindings defaults:
If any of the params below is None, then its default value below will be used:
* size: ImVec2(0,0)
* cmap: IMPLOT_AUTO
bust_color_cache¶
def bust_color_cache(plot_title_id: Optional[str] = None) -> NoneIMPLOT_API void BustColorCache(const char* plot_title_id = nullptr);When items in a plot sample their color from a colormap, the color is cached and does not change unless explicitly overridden. Therefore, if you change the colormap after the item has already been plotted, item colors will NOT update. If you need item colors to resample the new colormap, then use this function to bust the cached colors. If #plot_title_id is None, then every item in EVERY existing plot will be cache busted. Otherwise only the plot specified by #plot_title_id will be busted. For the latter, this function must be called in the same ImGui ID scope that the plot is in. You should rarely if ever need this function, but it is available for applications that require runtime colormap swaps (e.g. Heatmaps demo).
Input Mapping¶
get_input_map¶
def get_input_map() -> InputMapIMPLOT_API ImPlotInputMap& GetInputMap();Provides access to input mapping structure for permanent modifications to controls for pan, select, etc.
map_input_default¶
def map_input_default(dst: Optional[InputMap] = None) -> NoneIMPLOT_API void MapInputDefault(ImPlotInputMap* dst = nullptr);Default input mapping: pan = LMB drag, box select = RMB drag, fit = LMB double click, context menu = RMB click, zoom = scroll.
map_input_reverse¶
def map_input_reverse(dst: Optional[InputMap] = None) -> NoneIMPLOT_API void MapInputReverse(ImPlotInputMap* dst = nullptr);Reverse input mapping: pan = RMB drag, box select = LMB drag, fit = LMB double click, context menu = RMB click, zoom = scroll.
Miscellaneous¶
item_icon¶
@overload
def item_icon(col: ImVec4Like) -> None
@overload
def item_icon(col: ImU32) -> NoneIMPLOT_API void ItemIcon(const ImVec4& col);
IMPLOT_API void ItemIcon(ImU32 col);Render icons similar to those that appear in legends (nifty for data lists).
colormap_icon¶
def colormap_icon(cmap: Colormap) -> NoneIMPLOT_API void ColormapIcon(ImPlotColormap cmap);get_plot_draw_list¶
def get_plot_draw_list() -> ImDrawListIMPLOT_API ImDrawList* GetPlotDrawList();Get the plot draw list for custom rendering to the current plot area. Call between Begin/EndPlot.
push_plot_clip_rect¶
def push_plot_clip_rect(expand: float = 0) -> NoneIMPLOT_API void PushPlotClipRect(float expand=0);Push clip rect for rendering to current plot area. The rect can be expanded or contracted by #expand pixels. Call between Begin/EndPlot.
pop_plot_clip_rect¶
def pop_plot_clip_rect() -> NoneIMPLOT_API void PopPlotClipRect();Pop plot clip rect. Call between Begin/EndPlot.
show_style_selector¶
def show_style_selector(label: str) -> boolIMPLOT_API bool ShowStyleSelector(const char* label);Shows ImPlot style selector dropdown menu.
show_colormap_selector¶
def show_colormap_selector(label: str) -> boolIMPLOT_API bool ShowColormapSelector(const char* label);Shows ImPlot colormap selector dropdown menu.
show_input_map_selector¶
def show_input_map_selector(label: str) -> boolIMPLOT_API bool ShowInputMapSelector(const char* label);Shows ImPlot input map selector dropdown menu.
show_style_editor¶
def show_style_editor(ref: Optional[Style] = None) -> NoneIMPLOT_API void ShowStyleEditor(ImPlotStyle* ref = nullptr);Shows ImPlot style editor block (not a window).
show_user_guide¶
def show_user_guide() -> NoneIMPLOT_API void ShowUserGuide();Add basic help/info block for end users (not a window).
show_metrics_window¶
def show_metrics_window(p_popen: Optional[bool] = None) -> Optional[bool]IMPLOT_API void ShowMetricsWindow(bool* p_popen = nullptr);Shows ImPlot metrics/debug information window.
Demo¶
show_demo_window¶
def show_demo_window(p_open: Optional[bool] = None) -> Optional[bool]IMPLOT_API void ShowDemoWindow(bool* p_open = nullptr);Shows the ImPlot demo window (add implot_demo.cpp to your sources!)
show_demo_window_maybe_docked¶
def show_demo_window_maybe_docked(create_window: bool, p_open: Optional[bool] = None, initial_extra_flags: WindowFlags = 0, window_pos: Optional[ImVec2Like] = None, window_size: Optional[ImVec2Like] = None) -> Optional[bool]IMPLOT_API void ShowDemoWindow_MaybeDocked(bool create_window, bool* p_open = NULL, ImGuiWindowFlags initial_extra_flags = 0, ImVec2 window_pos = ImVec2(0, 0), ImVec2 window_size = ImVec2(0, 0));Bundle: ShowDemoWindow_MaybeDocked is ShowDemoWindow, but can be used without creating an ImGui window.
Python bindings defaults:
If any of the params below is None, then its default value below will be used:
* window_pos: ImVec2(0, 0)
* window_size: ImVec2(0, 0)
Python helpers (manual bindings)¶
Add a new colormap. The color data will be copied. The colormap can be used by pushing either the returned index or the
string name with PushColormap. The colormap name must be unique and the size must be greater than 1. You will receive
an assert otherwise! By default, colormaps are considered to be qualitative (i.e. discrete). If you want to create a
continuous colormap, set #qual=False. This will treat the colors you provide as keys, and ImPlot will build a linearly
interpolated lookup table. The memory footprint of this table will be exactly ((size-1)*255+1)*4 bytes.
Warning:
The colormap ‘cols’ must either be a 1D array of type uint32 (if using hexadecimal colors),
or a 2D (Nx4 ->RGBA) array of type float32 (if using float values between 0 and 1)
add_colormap¶
def add_colormap(name: str, cols: np.ndarray, qual: bool = True) -> Colormapsetup_axis_ticks¶
@overload
def setup_axis_ticks(axis: ImAxis, v_min: float, v_max: float, n_ticks: int, labels: List[str] | None = None, keep_default: bool = False) -> None
@overload
def setup_axis_ticks(axis: ImAxis, values: List[float], labels: List[str] | None = None, keep_default: bool = False) -> NoneSets an axis’ ticks and optionally the labels for the next plot. To keep the default ticks, set #keep_default=true.
IMPLOT_API void SetupAxisTicks(ImAxis axis, double v_min, double v_max, int n_ticks, const char* const labels[]=nullptr, bool keep_default=false);plot_heatmap¶
def plot_heatmap(label_id: str, values: np.ndarray, scale_min: float = 0.0, scale_max: float = 0.0, label_fmt: str = '%.1f', bounds_min: Point = Point(0, 0), bounds_max: Point = Point(1, 1), spec: Spec = Spec()) -> NoneIMPLOT_TMP void PlotHeatmap(const char* label_id, const T* values, int rows, int cols, double scale_min=0, double scale_max=0, const char* label_fmt="%.1f", const ImPlotPoint& bounds_min=ImPlotPoint(0,0), const ImPlotPoint& bounds_max=ImPlotPoint(1,1), ImPlotHeatmapFlags flags=0);Plots a 2D heatmap chart. Values are expected to be in row-major order by default. Leave #scale_min and scale_max both at 0 for automatic color scaling, or set them to a predefined range. #label_fmt can be set to NULL for no labels.