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)¶
struct BoxedValue| 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)¶
enum ImAxis_See it live: Axes › Axis Constraints (also used in 19 other sections)

Code from the demo
if implot.begin_plot("##AxisConstraints", size=(-1, 0)):
implot.setup_axes("X", "Y", static.flags, static.flags)
implot.setup_axes_limits(-1, 1, -1, 1)
implot.setup_axis_limits_constraints(implot.ImAxis_.x1, static.constraints[0], static.constraints[1])
implot.setup_axis_zoom_constraints(implot.ImAxis_.x1, static.constraints[2], static.constraints[3])
implot.setup_axis_limits_constraints(implot.ImAxis_.y1, static.constraints[0], static.constraints[1])
implot.setup_axis_zoom_constraints(implot.ImAxis_.y1, static.constraints[2], static.constraints[3])
implot.end_plot()The type of its values in the API: ImAxis = int (C++ typedef int ImAxis;)
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)¶
enum ImPlotProp_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)¶
enum ImPlotFlags_The type of its values in the API: Flags = int (C++ typedef int ImPlotFlags;)
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)¶
enum ImPlotAxisFlags_The type of its values in the API: AxisFlags = int (C++ typedef int ImPlotAxisFlags;)
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)¶
enum ImPlotSubplotFlags_The type of its values in the API: SubplotFlags = int (C++ typedef int ImPlotSubplotFlags;)
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)¶
enum ImPlotLegendFlags_The type of its values in the API: LegendFlags = int (C++ typedef int ImPlotLegendFlags;)
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)¶
enum ImPlotMouseTextFlags_The type of its values in the API: MouseTextFlags = int (C++ typedef int ImPlotMouseTextFlags;)
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)¶
enum ImPlotDragToolFlags_The type of its values in the API: DragToolFlags = int (C++ typedef int ImPlotDragToolFlags;)
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)¶
enum ImPlotColormapScaleFlags_The type of its values in the API: ColormapScaleFlags = int (C++ typedef int ImPlotColormapScaleFlags;)
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)¶
enum ImPlotItemFlags_The type of its values in the API: ItemFlags = int (C++ typedef int ImPlotItemFlags;)
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)¶
enum ImPlotLineFlags_The type of its values in the API: LineFlags = int (C++ typedef int ImPlotLineFlags;)
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)¶
enum ImPlotScatterFlags_The type of its values in the API: ScatterFlags = int (C++ typedef int ImPlotScatterFlags;)
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)¶
enum ImPlotBubblesFlags_Flags for PlotBubbles. Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotBubblesFlags_None = 0 | default |
PolygonFlags_ (enum)¶
enum ImPlotPolygonFlags_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)¶
enum ImPlotStairsFlags_The type of its values in the API: StairsFlags = int (C++ typedef int ImPlotStairsFlags;)
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)¶
enum ImPlotShadedFlags_The type of its values in the API: ShadedFlags = int (C++ typedef int ImPlotShadedFlags;)
Flags for PlotShaded (placeholder). Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotShadedFlags_None = 0 | default |
BarsFlags_ (enum)¶
enum ImPlotBarsFlags_The type of its values in the API: BarsFlags = int (C++ typedef int ImPlotBarsFlags;)
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)¶
enum ImPlotBarGroupsFlags_The type of its values in the API: BarGroupsFlags = int (C++ typedef int ImPlotBarGroupsFlags;)
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)¶
enum ImPlotErrorBarsFlags_The type of its values in the API: ErrorBarsFlags = int (C++ typedef int ImPlotErrorBarsFlags;)
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)¶
enum ImPlotStemsFlags_The type of its values in the API: StemsFlags = int (C++ typedef int ImPlotStemsFlags;)
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)¶
enum ImPlotInfLinesFlags_The type of its values in the API: InfLinesFlags = int (C++ typedef int ImPlotInfLinesFlags;)
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)¶
enum ImPlotPieChartFlags_The type of its values in the API: PieChartFlags = int (C++ typedef int ImPlotPieChartFlags;)
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)¶
enum ImPlotHeatmapFlags_The type of its values in the API: HeatmapFlags = int (C++ typedef int ImPlotHeatmapFlags;)
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)¶
enum ImPlotHistogramFlags_The type of its values in the API: HistogramFlags = int (C++ typedef int ImPlotHistogramFlags;)
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)¶
enum ImPlotDigitalFlags_The type of its values in the API: DigitalFlags = int (C++ typedef int ImPlotDigitalFlags;)
Flags for PlotDigital (placeholder). Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotDigitalFlags_None = 0 | default |
ImageFlags_ (enum)¶
enum ImPlotImageFlags_The type of its values in the API: ImageFlags = int (C++ typedef int ImPlotImageFlags;)
Flags for PlotImage (placeholder). Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotImageFlags_None = 0 | default |
TextFlags_ (enum)¶
enum ImPlotTextFlags_The type of its values in the API: TextFlags = int (C++ typedef int ImPlotTextFlags;)
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)¶
enum ImPlotDummyFlags_The type of its values in the API: DummyFlags = int (C++ typedef int ImPlotDummyFlags;)
Flags for PlotDummy (placeholder). Used by setting ImPlotSpec::Flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImPlotDummyFlags_None = 0 | default |
Cond_ (enum)¶
enum ImPlotCond_The type of its values in the API: Cond = int (C++ typedef int ImPlotCond;)
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)¶
enum ImPlotCol_The type of its values in the API: Col = int (C++ typedef int ImPlotCol;)
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)¶
enum ImPlotStyleVar_The type of its values in the API: StyleVar = int (C++ typedef int ImPlotStyleVar;)
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)¶
enum ImPlotScale_See it live: Axes › Log Scale (also used in 4 other sections)

Code from the demo
if implot.begin_plot("Log Plot", size=(-1, 0)):
implot.setup_axis_scale(implot.ImAxis_.x1, implot.Scale_.log10)
implot.setup_axes_limits(0.1, 100, 0, 10)
implot.plot_line("f(x) = x", static.xs, static.xs)
implot.plot_line("f(x) = sin(x)+1", static.xs, static.ys1)
implot.plot_line("f(x) = log(x)", static.xs, static.ys2)
implot.plot_line("f(x) = 10^x", static.xs[:21], static.ys3)
implot.end_plot()The type of its values in the API: Scale = int (C++ typedef int ImPlotScale;)
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)¶
enum ImPlotMarker_See it live: Plots › Markers and Text (also used in 12 other sections)

Code from the demo
if not hasattr(static, "spec"):
static.spec = implot.Spec(marker=implot.Marker_.auto)
# Default values from ImPlotSpec: MarkerSize = 4, LineWeight = 1.0
static.mk_size = static.spec.marker_size
static.mk_weight = static.spec.line_weightThe type of its values in the API: Marker = int (C++ typedef int ImPlotMarker;)
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)¶
enum ImPlotColormap_See it live: Tools › Colormap Widgets (also used in 14 other sections)

Code from the demo
if not hasattr(static, "cmap"):
static.cmap = implot.Colormap_.viridis
static.t = 0.5
static.col = [1.0, 1.0, 1.0, 1.0] # Placeholder color
static.scale = [0, 100]
static.flags = 0The type of its values in the API: Colormap = int (C++ typedef int ImPlotColormap;)
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)¶
enum ImPlotLocation_The type of its values in the API: Location = int (C++ typedef int ImPlotLocation;)
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)¶
enum ImPlotBin_The type of its values in the API: Bin = int (C++ typedef int ImPlotBin;)
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)¶
struct ImPlotSpecPlot 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)¶
struct ImPlotPointSee it live: Tools › Drag Points (also used in 3 other sections)

Code from the demo
if not hasattr(static, "P"):
static.P = [implot.Point(0.05, 0.05), implot.Point(0.2, 0.4), implot.Point(0.8, 0.6), implot.Point(0.95, 0.95)]| 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);See it live: Tools › Drag Points (also used in 3 other sections)

Range (class)¶
struct ImPlotRangeRange 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)¶
struct ImPlotRectSee it live: Tools › Drag Rects (also used in 3 other sections)

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)¶
struct ImPlotStyleSee it live: Custom › Custom Styles

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)¶
struct ImPlotInputMapInput 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);See it live: Plots › Line Plots (also used in 56 other sections)

Code from the demo
if implot.begin_plot("Line Plots"):
implot.setup_axes("x", "y")
implot.plot_line("f(x)", static.xs1, static.ys1)
implot.plot_line("g(x)", static.xs2, static.ys2,
spec=implot.Spec(flags=implot.LineFlags_.segments, marker=implot.Marker_.circle))
implot.end_plot()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();See it live: Plots › Line Plots (also used in 56 other sections)

Code from the demo
if implot.begin_plot("Line Plots"):
implot.setup_axes("x", "y")
implot.plot_line("f(x)", static.xs1, static.ys1)
implot.plot_line("g(x)", static.xs2, static.ys2,
spec=implot.Spec(flags=implot.LineFlags_.segments, marker=implot.Marker_.circle))
implot.end_plot()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)¶
struct SubplotsRowColRatios| 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();See it live: Subplots › Sizing (also used in 2 other sections)

Code from the demo
implot.end_subplots()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);See it live: Axes › Custom Scale (also used in 5 other sections)

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);See it live: Plots › Stem Plots (also used in 5 other sections)

Code from the demo
if implot.begin_plot("Stem Plots"):
implot.setup_axis_limits(implot.ImAxis_.x1, 0, 1.0)
implot.setup_axis_limits(implot.ImAxis_.y1, 0, 1.6)
implot.plot_stems("Stems 1", static.xs, static.ys1)
implot.plot_stems("Stems 2", static.xs, static.ys2,
spec=implot.Spec(marker=implot.Marker_.circle))
implot.end_plot()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);See it live: Axes › Linked Axes

Code from the demo
if static.linkx:
implot.setup_axis_links(implot.ImAxis_.x1, static.x_min, static.x_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);See it live: Axes › Tick Labels (also used in 1 other section)

Code from the demo
implot.setup_axes_limits(2.5, 5, 0, 1000)
implot.setup_axis(implot.ImAxis_.y2, None, implot.AxisFlags_.aux_default)
implot.setup_axis(implot.ImAxis_.y3, None, implot.AxisFlags_.aux_default)
if static.custom_fmt:
implot.setup_axis_format(implot.ImAxis_.x1, "%g ms")
implot.setup_axis_format(implot.ImAxis_.y1, "%g Hz")
implot.setup_axis_format(implot.ImAxis_.y2, "%g dB")
implot.setup_axis_format(implot.ImAxis_.y3, "%g m")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);See it live: Axes › Log Scale (also used in 5 other sections)

Code from the demo
if implot.begin_plot("Log Plot", size=(-1, 0)):
implot.setup_axis_scale(implot.ImAxis_.x1, implot.Scale_.log10)
implot.setup_axes_limits(0.1, 100, 0, 10)
implot.plot_line("f(x) = x", static.xs, static.xs)
implot.plot_line("f(x) = sin(x)+1", static.xs, static.ys1)
implot.plot_line("f(x) = log(x)", static.xs, static.ys2)
implot.plot_line("f(x) = 10^x", static.xs[:21], static.ys3)
implot.end_plot()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);See it live: Axes › Custom Scale (also used in 2 other sections)

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);See it live: Axes › Axis Constraints (also used in 1 other section)

Code from the demo
if implot.begin_plot("##AxisConstraints", size=(-1, 0)):
implot.setup_axes("X", "Y", static.flags, static.flags)
implot.setup_axes_limits(-1, 1, -1, 1)
implot.setup_axis_limits_constraints(implot.ImAxis_.x1, static.constraints[0], static.constraints[1])
implot.setup_axis_zoom_constraints(implot.ImAxis_.x1, static.constraints[2], static.constraints[3])
implot.setup_axis_limits_constraints(implot.ImAxis_.y1, static.constraints[0], static.constraints[1])
implot.setup_axis_zoom_constraints(implot.ImAxis_.y1, static.constraints[2], static.constraints[3])
implot.end_plot()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);See it live: Plots › Line Plots (also used in 22 other sections)

Code from the demo
if implot.begin_plot("Line Plots"):
implot.setup_axes("x", "y")
implot.plot_line("f(x)", static.xs1, static.ys1)
implot.plot_line("g(x)", static.xs2, static.ys2,
spec=implot.Spec(flags=implot.LineFlags_.segments, marker=implot.Marker_.circle))
implot.end_plot()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);See it live: Plots › Filled Line Plots (also used in 22 other sections)

Code from the demo
if implot.begin_plot("Stock Prices"):
implot.setup_axes("Days", "Price")
implot.setup_axes_limits(0, 100, 0, 500)
if static.show_fills:
spec = implot.Spec(flags=static.flags, fill_alpha=0.25)
ref_value = -np.inf if static.shade_mode == 0 else np.inf if static.shade_mode == 1 else static.fill_ref
implot.plot_shaded("Stock 1", static.xs1, static.ys1, ref_value, spec)
implot.plot_shaded("Stock 2", static.xs1, static.ys2, ref_value, spec)
implot.plot_shaded("Stock 3", static.xs1, static.ys3, ref_value, spec)
if static.show_lines:
implot.plot_line("Stock 1", static.xs1, static.ys1)
implot.plot_line("Stock 2", static.xs1, static.ys2)
...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);See it live: Tools › Legend Options (also used in 5 other sections)

Code from the demo
if implot.begin_plot("##Legend", size=(-1, 0)):
implot.setup_legend(static.loc, static.flags)
# Precomputed saw wave data for demo items
t = np.linspace(0, 1, 1000, dtype=np.float64)
offsets = [0.2, 0.4, 0.6, 0.8, 1.0]
saw = [2.0 / np.pi * np.arctan(1.0 / np.tan(np.pi * 4 * t)) * 0.2 + o
for o in offsets]
implot.plot_line("Item 002", t, saw[0])
implot.plot_line("Item 001##IDText", t, saw[1]) # ## part used for ID only
implot.plot_line("##NotListed", t, saw[2]) # not added to legend
implot.plot_line("Item 003", t, saw[3])
implot.plot_line("Item 003", t, saw[4]) # combined with previous "Item 003"
...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 begin_plot 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());See it live: Plots › Line Plots (also used in 29 other sections)

Code from the demo
if implot.begin_plot("Line Plots"):
implot.setup_axes("x", "y")
implot.plot_line("f(x)", static.xs1, static.ys1)
implot.plot_line("g(x)", static.xs2, static.ys2,
spec=implot.Spec(flags=implot.LineFlags_.segments, marker=implot.Marker_.circle))
implot.end_plot()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());See it live: Plots › Scatter Plots (also used in 7 other sections)

Code from the demo
if implot.begin_plot("Scatter Plot"):
implot.plot_scatter("Data 1", static.xs1, static.ys1)
implot.plot_scatter("Data 2", static.xs2, static.ys2,
spec=implot.Spec(
marker=implot.Marker_.square,
marker_size=6,
line_color=implot.get_colormap_color(1),
fill_color=implot.get_colormap_color(1),
fill_alpha=0.25))
implot.end_plot()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());See it live: Plots › Bubble Plots (also used in 1 other section)

Code from the demo
if implot.begin_plot("Bubble Plot", flags=implot.Flags_.equal):
implot.plot_bubbles("Data 1", static.xs, static.ys1, static.sz1,
spec=implot.Spec(fill_alpha=0.5))
implot.plot_bubbles("Data 2", static.xs, static.ys2, static.sz2,
spec=implot.Spec(fill_alpha=0.5, line_color=ImVec4(0, 0, 0, 0)))
implot.end_plot()Plots a bubble graph. #szs are the radius of each bubble in plot units.
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_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());See it live: Plots › Polygon Plots

Code from the demo
if implot.begin_plot("Polygon Plot", ImVec2(-1, 0), implot.Flags_.equal):
implot.plot_polygon("Triangle", static.tri_xs, static.tri_ys,
spec=implot.Spec(fill_alpha=0.5))
implot.plot_polygon("Pentagon", static.pent_xs, static.pent_ys,
spec=implot.Spec(fill_alpha=0.5, fill_color=ImVec4(0, 1, 0, 1)))
implot.plot_polygon("Star (Concave)", static.star_xs, static.star_ys,
spec=implot.Spec(fill_alpha=0.5, fill_color=ImVec4(1, 1, 0, 1),
flags=implot.PolygonFlags_.concave))
implot.end_plot()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());See it live: Plots › Stairstep Plots (also used in 1 other section)

Code from the demo
spec = implot.Spec(flags=static.flags, fill_alpha=0.25, marker=implot.Marker_.circle)
implot.plot_stairs("Post Step (default)", static.ys1, xscale=0.05, spec=spec)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());See it live: Plots › Shaded Plots (also used in 4 other sections)

Code from the demo
if implot.begin_plot("Shaded Plots"):
implot.setup_legend(implot.Location_.north_west, implot.LegendFlags_.reverse) # reverse legend to match vertical order on plot
implot.plot_shaded("Uncertain Data", static.xs, static.ys1, static.ys2, static.spec)
implot.plot_line("Uncertain Data", static.xs, static.ys, static.spec)
implot.plot_shaded("Overlapping", static.xs, static.ys3, static.ys4, static.spec)
implot.plot_line("Overlapping", static.xs, static.ys3, static.spec)
implot.plot_line("Overlapping", static.xs, static.ys4, static.spec)
implot.end_plot()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());See it live: Plots › Bar Plots (also used in 6 other sections)

Code from the demo
if implot.begin_plot("Bar Plot"):
implot.plot_bars("Vertical", static.data, bar_size=0.7, shift=1)
implot.plot_bars("Horizontal", static.data, bar_size=0.4, shift=1,
spec=implot.Spec(flags=implot.BarsFlags_.horizontal))
implot.end_plot()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());See it live: Plots › Bar Groups (also used in 1 other section)

Code from the demo
)
implot.plot_bar_groups(
label_ids=static.ilabels,
values=static.data,
group_size=static.groups,
shift=0,
spec=implot.Spec(flags=static.flags | implot.BarGroupsFlags_.horizontal))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());See it live: Plots › Error Bars

Code from the demo
if implot.begin_plot("##ErrorBars"):
implot.setup_axes_limits(0, 6, 0, 10)
implot.plot_bars("Bar", static.xs, static.bar, bar_size=0.5)
implot.plot_error_bars("Bar", static.xs, static.bar, static.err1)
implot.plot_error_bars("Line", static.xs, static.lin1, static.err1, static.err2,
spec=implot.Spec(line_color=implot.get_colormap_color(1), size=0))
implot.plot_line("Line", static.xs, static.lin1,
spec=implot.Spec(marker=implot.Marker_.square))
spec = implot.Spec(
line_color=implot.get_colormap_color(2),
size=6,
...Plots vertical error bar. The label_id should be the same as the label_id of the associated line or bar plot.
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_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());See it live: Plots › Stem Plots (also used in 2 other sections)

Code from the demo
if implot.begin_plot("Stem Plots"):
implot.setup_axis_limits(implot.ImAxis_.x1, 0, 1.0)
implot.setup_axis_limits(implot.ImAxis_.y1, 0, 1.6)
implot.plot_stems("Stems 1", static.xs, static.ys1)
implot.plot_stems("Stems 2", static.xs, static.ys2,
spec=implot.Spec(marker=implot.Marker_.circle))
implot.end_plot()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());See it live: Plots › Infinite Lines (also used in 1 other section)

Code from the demo
if implot.begin_plot("##Infinite"):
implot.setup_axes("", "", implot.AxisFlags_.no_initial_fit, implot.AxisFlags_.no_initial_fit)
implot.plot_inf_lines("Vertical", static.vals)
implot.plot_inf_lines("Horizontal", static.vals,
spec=implot.Spec(flags=implot.InfLinesFlags_.horizontal))
implot.end_plot()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());See it live: Plots › Pie Charts

Code from the demo
if implot.begin_plot("##Pie1", size=(250, 250), flags=implot.Flags_.equal | implot.Flags_.no_mouse_text):
implot.setup_axes("", "", implot.AxisFlags_.no_decorations, implot.AxisFlags_.no_decorations)
implot.setup_axes_limits(0, 1, 0, 1)
implot.plot_pie_chart(static.labels1, np.array(static.data1), x=0.5, y=0.5, radius=0.4, label_fmt="%.2f", angle0=90,
spec=implot.Spec(flags=static.flags))
implot.end_plot()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());See it live: Plots › Histogram

Code from the demo
if implot.begin_plot("##Histograms"):
implot.setup_axes("", "", implot.AxisFlags_.auto_fit, implot.AxisFlags_.auto_fit)
implot.plot_histogram("Empirical", static.data, bins=static.bins, bar_scale=1.0,
range=implot.Range(static.rmin, static.rmax) if static.range else implot.Range(),
spec=implot.Spec(fill_alpha=0.5, flags=static.hist_flags))
if (static.hist_flags & implot.HistogramFlags_.density) and not (static.hist_flags & implot.HistogramFlags_.no_outliers):
if static.hist_flags & implot.HistogramFlags_.horizontal:
implot.plot_line("Theoretical", y, x)
else:
implot.plot_line("Theoretical", x, y)
implot.end_plot()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());See it live: Plots › Histogram 2D

Code from the demo
implot.push_colormap("Hot")
if implot.begin_plot("##Hist2D", size=(imgui.get_content_region_avail().x - 100 - imgui.get_style().item_spacing.x, 0)):
implot.setup_axes("", "", flags, flags)
implot.setup_axes_limits(-6, 6, -6, 6)
max_count = implot.plot_histogram_2d(
"Hist2D",
xs=static.dist1, ys=static.dist2,
x_bins=static.xybins[0], y_bins=static.xybins[1],
range=implot.Rect(-6, 6, -6, 6),
spec=implot.Spec(flags=static.hist_flags)) # type: ignore
implot.end_plot()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());See it live: Plots › Digital Plots

Code from the demo
if static.show_digital[i] and static.data_digital[i].size > 0:
implot.plot_digital(f"digital_{i}", *static.data_digital[i].get_data())Plots digital data. Digital plots do not respond to y drag or zoom, and are always referenced to the bottom of the plot.
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_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());See it live: Plots › Images

Code from the demo
if implot.begin_plot("##image"):
implot.plot_image("my image", static.tex_id_checker,
bounds_min=implot.Point(static.bmin[0], static.bmin[1]),
bounds_max=implot.Point(static.bmax[0], static.bmax[1]),
uv0=ImVec2(static.uv0[0], static.uv0[1]),
uv1=ImVec2(static.uv1[0], static.uv1[1]),
tint_col=ImVec4(static.tint[0], static.tint[1], static.tint[2], static.tint[3]))
implot.end_plot()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());See it live: Tools › Legend Options

Code from the demo
for i in range(static.num_dummy_items):
implot.plot_dummy(f"Item {i + 4:03d}")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);See it live: Tools › Drag Points

Code from the demo
colors = [ImVec4(0, 0.9, 0, 1), ImVec4(1, 0.5, 1, 1), ImVec4(0, 0.5, 1, 1), ImVec4(0, 0.9, 0, 1)]
for i in range(4):
_, static.P[i].x, static.P[i].y, *_ = implot.drag_point(
id_=i, x=static.P[i].x, y=static.P[i].y, col=colors[i], flags=static.flags)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 set_axis/set_axes. 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);See it live: Tools › Drag Lines

Code from the demo
if implot.begin_plot("##lines", size=(-1, 0)):
implot.setup_axes_limits(0, 1, 0, 1)
# Drag lines
_changed, static.x1, _, _, _ = implot.drag_line_x(0, x=static.x1, col=[1, 1, 1, 1], thickness=1, flags=static.flags)
_changed, static.x2, _, _, _ = implot.drag_line_x(1, x=static.x2, col=[1, 1, 1, 1], thickness=1, flags=static.flags)
_changed, static.y1, _, _, _ = implot.drag_line_y(2, static.y1, col=[1, 1, 1, 1], thickness=1, flags=static.flags)
_changed, static.y2, _, _, _ = implot.drag_line_y(3, static.y2, col=[1, 1, 1, 1], thickness=1, flags=static.flags)
# Compute curve based on dragged values
t_vals = np.linspace(-0.5, 0.5, 1000)
xs = (static.x2 + static.x1) / 2 + np.abs(static.x2 - static.x1) * t_vals
ys = (static.y1 + static.y2) / 2 + np.abs(static.y2 - static.y1) / 2 * np.sin(static.f * np.arange(1000) / 10)
...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);See it live: Tools › Drag Lines (also used in 1 other section)

Code from the demo
if implot.begin_plot("##lines", size=(-1, 0)):
implot.setup_axes_limits(0, 1, 0, 1)
# Drag lines
_changed, static.x1, _, _, _ = implot.drag_line_x(0, x=static.x1, col=[1, 1, 1, 1], thickness=1, flags=static.flags)
_changed, static.x2, _, _, _ = implot.drag_line_x(1, x=static.x2, col=[1, 1, 1, 1], thickness=1, flags=static.flags)
_changed, static.y1, _, _, _ = implot.drag_line_y(2, static.y1, col=[1, 1, 1, 1], thickness=1, flags=static.flags)
_changed, static.y2, _, _, _ = implot.drag_line_y(3, static.y2, col=[1, 1, 1, 1], thickness=1, flags=static.flags)
# Compute curve based on dragged values
t_vals = np.linspace(-0.5, 0.5, 1000)
xs = (static.x2 + static.x1) / 2 + np.abs(static.x2 - static.x1) * t_vals
ys = (static.y1 + static.y2) / 2 + np.abs(static.y2 - static.y1) / 2 * np.sin(static.f * np.arange(1000) / 10)
...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);See it live: Tools › Drag Rects (also used in 1 other section)

Code from the demo
plot_height = immapp.em_size() * 15
if implot.begin_plot("##Main", ImVec2(-1, plot_height)):
# implot.setup_axes("", "", implot.ImPlotAxisFlags_.no_tick_labels, implot.ImPlotAxisFlags_.no_tick_labels)
# implot.setup_axes_limits(0, 0.01, -1, 1)
implot.plot_line("Signal 1", state.x_data, state.y_data1)
implot.plot_line("Signal 2", state.x_data, state.y_data2)
implot.plot_line("Signal 3", state.x_data, state.y_data3)
(
_,
state.rect.x.min,
state.rect.y.min,
state.rect.x.max,
state.rect.y.max,
clicked,
...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, ...) ;See it live: Tools › Annotations (also used in 1 other section)

Code from the demo
col = implot.get_last_item_color()
implot.annotation(0.25, 0.25, col, ImVec2(-15, 15), static.clamp, "BL")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, ...) ;See it live: Tools › Tags

Code from the demo
if static.show:
implot.tag_x(0.25, ImVec4(1, 1, 0, 1))
implot.tag_y(0.75, ImVec4(1, 1, 0, 1))
_, static.drag_tag, _, _, _ = implot.drag_line_y(
id_=0, y=static.drag_tag, col=ImVec4(1, 0, 0, 1), thickness=1, flags=implot.DragToolFlags_.no_fit
)
implot.tag_y(static.drag_tag, ImVec4(1, 0, 0, 1), "Drag")
implot.set_axes(implot.ImAxis_.x2, implot.ImAxis_.y2)
implot.tag_x(0.5, ImVec4(0, 1, 1, 1), "MyTag")
implot.tag_y(0.5, ImVec4(0, 1, 1, 1), "Tag: %d" % 42)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, ...) ;See it live: Tools › Tags

Code from the demo
if static.show:
implot.tag_x(0.25, ImVec4(1, 1, 0, 1))
implot.tag_y(0.75, ImVec4(1, 1, 0, 1))
_, static.drag_tag, _, _, _ = implot.drag_line_y(
id_=0, y=static.drag_tag, col=ImVec4(1, 0, 0, 1), thickness=1, flags=implot.DragToolFlags_.no_fit
)
implot.tag_y(static.drag_tag, ImVec4(1, 0, 0, 1), "Drag")
implot.set_axes(implot.ImAxis_.x2, implot.ImAxis_.y2)
implot.tag_x(0.5, ImVec4(0, 1, 1, 1), "MyTag")
implot.tag_y(0.5, ImVec4(0, 1, 1, 1), "Tag: %d" % 42)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);See it live: Tools › Drag and Drop

Code from the demo
if static.dnd_plt[k] == 1:
implot.set_axis(static.dnd_yax[k])
xs, ys = static.dnd_data[k]
implot.plot_line(static.dnd_labels[k], xs, ys,
spec=implot.Spec(line_color=static.dnd_colors[k]))
if implot.begin_drag_drop_source_item(static.dnd_labels[k]):
imgui.set_drag_drop_payload_py_id(DND_TYPE, k)
implot.item_icon(static.dnd_colors[k])
imgui.same_line()
imgui.text_unformatted(static.dnd_labels[k])
implot.end_drag_drop_source()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);See it live: Axes › Multiple Axes (also used in 2 other sections)

Code from the demo
if static.x2_axis:
implot.set_axes(implot.ImAxis_.x2, implot.ImAxis_.y1)
implot.plot_line("f(x) = sin(x)*3+1", static.xs2, static.ys1)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);See it live: Custom › Custom Rendering

Code from the demo
if implot.begin_plot("##CustomRend"):
cntr = implot.plot_to_pixels(implot.Point(0.5, 0.5))
rmin = implot.plot_to_pixels(implot.Point(0.25, 0.75))
rmax = implot.plot_to_pixels(implot.Point(0.75, 0.25))
implot.push_plot_clip_rect()
draw_list = implot.get_plot_draw_list()
draw_list.add_circle_filled(cntr, 20, imgui.IM_COL32(255, 255, 0, 255), 20)
draw_list.add_rect(rmin, rmax, imgui.IM_COL32(128, 0, 255, 255))
implot.pop_plot_clip_rect()
implot.end_plot()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);See it live: Tools › Querying

Code from the demo
if implot.is_plot_hovered() and imgui.is_mouse_clicked(0) and imgui.get_io().key_ctrl:
pt = implot.get_plot_mouse_pos()
static.data_x = np.append(static.data_x, pt.x)
static.data_y = np.append(static.data_y, pt.y)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);See it live: Tools › Querying (also used in 1 other section)

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();See it live: Tools › Querying

Code from the demo
if implot.begin_plot("##Centroid"):
implot.setup_axes_limits(0, 1, 0, 1)
if implot.is_plot_hovered() and imgui.is_mouse_clicked(0) and imgui.get_io().key_ctrl:
pt = implot.get_plot_mouse_pos()
static.data_x = np.append(static.data_x, pt.x)
static.data_y = np.append(static.data_y, pt.y)
implot.plot_scatter("Points",
static.data_x.astype(np.float64),
static.data_y.astype(np.float64))
if implot.is_plot_selected():
sel = implot.get_plot_selection()
...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();See it live: Tools › Querying

Code from the demo
if implot.is_plot_selected():
sel = implot.get_plot_selection()
mask = ((static.data_x >= sel.x.min) & (static.data_x <= sel.x.max) &
(static.data_y >= sel.y.min) & (static.data_y <= sel.y.max))
if mask.sum() > 0:
cx = float(static.data_x[mask].mean())
cy = float(static.data_y[mask].mean())
implot.plot_scatter("Centroid", np.array([cx]), np.array([cy]), cent_spec)
if imgui.is_mouse_clicked(implot.get_input_map().select_cancel):
implot.cancel_plot_selection()
static.rects.append(sel)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);See it live: Tools › Querying

Code from the demo
if implot.is_plot_selected():
sel = implot.get_plot_selection()
mask = ((static.data_x >= sel.x.min) & (static.data_x <= sel.x.max) &
(static.data_y >= sel.y.min) & (static.data_y <= sel.y.max))
if mask.sum() > 0:
cx = float(static.data_x[mask].mean())
cy = float(static.data_y[mask].mean())
implot.plot_scatter("Centroid", np.array([cx]), np.array([cy]), cent_spec)
if imgui.is_mouse_clicked(implot.get_input_map().select_cancel):
implot.cancel_plot_selection()
static.rects.append(sel)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();See it live: Tools › Querying

Code from the demo
if imgui.is_mouse_clicked(implot.get_input_map().select_cancel):
implot.cancel_plot_selection()
static.rects.append(sel)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);See it live: Axes › Linked Axes

Code from the demo
if implot.begin_aligned_plots("AlignedGroup"):
if implot.begin_plot("Plot A"):
if static.linkx:
implot.setup_axis_links(implot.ImAxis_.x1, static.x_min, static.x_max)
if static.linky:
implot.setup_axis_links(implot.ImAxis_.y1, static.y_min, static.y_max)
implot.plot_line("Line", data)
implot.end_plot()
if implot.begin_plot("Plot B"):
if static.linkx:
implot.setup_axis_links(implot.ImAxis_.x1, static.x_min, static.x_max)
if static.linky:
implot.setup_axis_links(implot.ImAxis_.y1, static.y_min, static.y_max)
...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);See it live: Tools › Legend Popups

Code from the demo
if implot.begin_legend_popup("Right Click Me"):
_, static.frequency = imgui.slider_float("Frequency", static.frequency, 0, 1, "%0.2f")
_, static.amplitude = imgui.slider_float("Amplitude", static.amplitude, 0, 1, "%0.2f")
imgui.separator()
_, static.color = imgui.color_edit3("Color", static.color[:3])
_, static.alpha = imgui.slider_float("Transparency", static.alpha, 0, 1, "%.2f")
_, static.line = imgui.checkbox("Line Plot", static.line)
if static.line:
_, static.thickness = imgui.slider_float("Thickness", static.thickness, 0, 5)
_, static.markers = imgui.checkbox("Markers", static.markers)
_, static.shaded = imgui.checkbox("Shaded", static.shaded)
implot.end_legend_popup()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();See it live: Tools › Drag and Drop (also used in 1 other section)

Code from the demo
if implot.begin_drag_drop_target_plot():
payload = imgui.accept_drag_drop_payload_py_id(DND_TYPE)
if payload is not None:
i = payload.data_id
static.dnd_plt[i] = 1
static.dnd_yax[i] = implot.ImAxis_.y1
implot.end_drag_drop_target()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);See it live: Tools › Drag and Drop

Code from the demo
for y in [implot.ImAxis_.y1, implot.ImAxis_.y2, implot.ImAxis_.y3]:
if implot.begin_drag_drop_target_axis(y):
payload = imgui.accept_drag_drop_payload_py_id(DND_TYPE)
if payload is not None:
i = payload.data_id
static.dnd_plt[i] = 1
static.dnd_yax[i] = y
implot.end_drag_drop_target()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();See it live: Tools › Drag and Drop

Code from the demo
if implot.begin_drag_drop_target_legend():
payload = imgui.accept_drag_drop_payload_py_id(DND_TYPE)
if payload is not None:
i = payload.data_id
static.dnd_plt[i] = 1
static.dnd_yax[i] = implot.ImAxis_.y1
implot.end_drag_drop_target()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();See it live: Tools › Drag and Drop (also used in 1 other section)

Code from the demo
if imgui.begin_drag_drop_target():
payload = imgui.accept_drag_drop_payload_py_id(DND_TYPE)
if payload is not None:
i = payload.data_id
static.dnd_plt[i] = 0
static.dnd_yax[i] = implot.ImAxis_.y1
imgui.end_drag_drop_target()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);See it live: Tools › Drag and Drop

Code from the demo
if implot.begin_drag_drop_source_plot():
imgui.text_unformatted("Yes, you can\ndrag this!")
implot.end_drag_drop_source()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);See it live: Tools › Drag and Drop

Code from the demo
if static.dndx >= 0 and implot.begin_drag_drop_source_axis(implot.ImAxis_.x1):
imgui.set_drag_drop_payload_py_id(DND_TYPE, static.dndx)
implot.item_icon(static.dnd_colors[static.dndx])
imgui.same_line()
imgui.text_unformatted(static.dnd_labels[static.dndx])
implot.end_drag_drop_source()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);See it live: Tools › Drag and Drop (also used in 1 other section)

Code from the demo
if static.dnd_plt[k] == 1:
implot.set_axis(static.dnd_yax[k])
xs, ys = static.dnd_data[k]
implot.plot_line(static.dnd_labels[k], xs, ys,
spec=implot.Spec(line_color=static.dnd_colors[k]))
if implot.begin_drag_drop_source_item(static.dnd_labels[k]):
imgui.set_drag_drop_payload_py_id(DND_TYPE, k)
implot.item_icon(static.dnd_colors[k])
imgui.same_line()
imgui.text_unformatted(static.dnd_labels[k])
implot.end_drag_drop_source()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();See it live: Tools › Drag and Drop (also used in 1 other section)

Code from the demo
implot.item_icon(static.dnd_colors[k])
imgui.same_line()
imgui.selectable(static.dnd_labels[k], False, 0, (100, 0))
if imgui.begin_drag_drop_source(imgui.DragDropFlags_.none):
imgui.set_drag_drop_payload_py_id(DND_TYPE, k)
implot.item_icon(static.dnd_colors[k])
imgui.same_line()
imgui.text_unformatted(static.dnd_labels[k])
imgui.end_drag_drop_source()Ends a drag and drop source (currently just an alias for ImGui::EndDragDropSource).
Styling¶
get_style¶
def get_style() -> StyleIMPLOT_API ImPlotStyle& GetStyle();See it live: Custom › Custom Styles (also used in 7 other sections)

Code from the demo
import copy
implot.push_colormap(implot.Colormap_.deep)
backup_style = copy.copy(implot.get_style())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);See it live: Plots › Markers and Text (also used in 2 other sections)

Code from the demo
implot.push_style_color(implot.Col_.inlay_text, [1, 0, 1, 1])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);See it live: Plots › Markers and Text (also used in 2 other sections)

Code from the demo
implot.pop_style_color()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();See it live: Tools › Annotations (also used in 2 other sections)

Code from the demo
if implot.begin_plot("##Annotations"):
implot.setup_axes_limits(0, 2, 0, 1)
px = np.array([0.25, 0.25, 0.75, 0.75], dtype=np.float32)
py = np.array([0.25, 0.75, 0.75, 0.25], dtype=np.float32)
implot.plot_scatter("##Points", px, py)
col = implot.get_last_item_color()
implot.annotation(0.25, 0.25, col, ImVec2(-15, 15), static.clamp, "BL")
implot.annotation(0.75, 0.25, col, ImVec2(15, 15), static.clamp, "BR")
implot.annotation(0.75, 0.75, col, ImVec2(15, -15), static.clamp, "TR")
implot.annotation(0.25, 0.75, col, ImVec2(-15, -15), static.clamp, "TL")
implot.annotation(0.5, 0.5, col, ImVec2(0, 0), static.clamp, "Center")
...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();See it live: Plots › Heatmaps (also used in 1 other section)

Code from the demo
if implot.colormap_button(implot.get_colormap_name(static.map), size=(225, 0), cmap=static.map):
static.map = (static.map + 1) % implot.get_colormap_count()
implot.bust_color_cache("##Heatmap1")
implot.bust_color_cache("##Heatmap2")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);See it live: Plots › Heatmaps

Code from the demo
if implot.colormap_button(implot.get_colormap_name(static.map), size=(225, 0), cmap=static.map):
static.map = (static.map + 1) % implot.get_colormap_count()
implot.bust_color_cache("##Heatmap1")
implot.bust_color_cache("##Heatmap2")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);See it live: Plots › Bar Stacks (also used in 6 other sections)

Code from the demo
implot.push_colormap(static.liars)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);See it live: Plots › Bar Stacks (also used in 6 other sections)

Code from the demo
implot.pop_colormap()Undo temporary colormap modification(s). Undo multiple pushes at once by increasing count.
next_colormap_color¶
def next_colormap_color() -> ImVec4IMPLOT_API ImVec4 NextColormapColor();See it live: Custom › Custom Styles

Code from the demo
dot = np.array([7, 6, 6, 7, 8, 5, 6, 5, 8, 7], dtype=np.uint32)
implot.plot_bars("Bars", bar, 0.5)
implot.plot_line("Line", lin)
implot.next_colormap_color() # skip greenReturns 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);See it live: Plots › Scatter Plots (also used in 3 other sections)

Code from the demo
if implot.begin_plot("Scatter Plot"):
implot.plot_scatter("Data 1", static.xs1, static.ys1)
implot.plot_scatter("Data 2", static.xs2, static.ys2,
spec=implot.Spec(
marker=implot.Marker_.square,
marker_size=6,
line_color=implot.get_colormap_color(1),
fill_color=implot.get_colormap_color(1),
fill_alpha=0.25))
implot.end_plot()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);See it live: Colorful Lines (also used in 7 other sections)

Code from the demo
static.colors2 = np.array([
imgui.get_color_u32(implot.sample_colormap(i / 19.0, implot.Colormap_.viridis))
for i in range(20)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);See it live: Tools › Colormap Widgets (also used in 2 other sections)

Code from the demo
implot.colormap_scale("Scale", static.scale[0], static.scale[1], size=(0, 0), format="%g dB", flags=static.flags, cmap=static.cmap)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);See it live: Tools › Colormap Widgets

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);See it live: Tools › Colormap Widgets (also used in 1 other section)

Code from the demo
if implot.colormap_button("Button", size=(0, 0), cmap=static.cmap):
static.cmap = (static.cmap + 1) % implot.get_colormap_count()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);See it live: Plots › Heatmaps

Code from the demo
if implot.colormap_button(implot.get_colormap_name(static.map), size=(225, 0), cmap=static.map):
static.map = (static.map + 1) % implot.get_colormap_count()
implot.bust_color_cache("##Heatmap1")
implot.bust_color_cache("##Heatmap2")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();See it live: Tools › Querying

Code from the demo
if imgui.is_mouse_clicked(implot.get_input_map().select_cancel):
implot.cancel_plot_selection()
static.rects.append(sel)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);See it live: Subplots › Item Sharing (also used in 1 other section)

Code from the demo
if imgui.begin_drag_drop_source():
static.curj = j
imgui.set_drag_drop_payload_py_id("MY_DND", 0, 0)
implot.item_icon(implot.get_last_item_color())
imgui.same_line()
imgui.text(label)
imgui.end_drag_drop_source()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();See it live: Custom › Custom Rendering

Code from the demo
if implot.begin_plot("##CustomRend"):
cntr = implot.plot_to_pixels(implot.Point(0.5, 0.5))
rmin = implot.plot_to_pixels(implot.Point(0.25, 0.75))
rmax = implot.plot_to_pixels(implot.Point(0.75, 0.25))
implot.push_plot_clip_rect()
draw_list = implot.get_plot_draw_list()
draw_list.add_circle_filled(cntr, 20, imgui.IM_COL32(255, 255, 0, 255), 20)
draw_list.add_rect(rmin, rmax, imgui.IM_COL32(128, 0, 255, 255))
implot.pop_plot_clip_rect()
implot.end_plot()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);See it live: Custom › Custom Rendering

Code from the demo
if implot.begin_plot("##CustomRend"):
cntr = implot.plot_to_pixels(implot.Point(0.5, 0.5))
rmin = implot.plot_to_pixels(implot.Point(0.25, 0.75))
rmax = implot.plot_to_pixels(implot.Point(0.75, 0.25))
implot.push_plot_clip_rect()
draw_list = implot.get_plot_draw_list()
draw_list.add_circle_filled(cntr, 20, imgui.IM_COL32(255, 255, 0, 255), 20)
draw_list.add_rect(rmin, rmax, imgui.IM_COL32(128, 0, 255, 255))
implot.pop_plot_clip_rect()
implot.end_plot()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();See it live: Custom › Custom Rendering

Code from the demo
draw_list = implot.get_plot_draw_list()
draw_list.add_circle_filled(cntr, 20, imgui.IM_COL32(255, 255, 0, 255), 20)
draw_list.add_rect(rmin, rmax, imgui.IM_COL32(128, 0, 255, 255))
implot.pop_plot_clip_rect()Pop plot clip rect. Call between Begin/EndPlot.
show_style_selector¶
def show_style_selector(label: str) -> boolIMPLOT_API bool ShowStyleSelector(const char* label);See it live: Config

Code from the demo
imgui.show_font_selector("Font")
imgui.show_style_selector("ImGui Style")Shows ImPlot style selector dropdown menu.
show_colormap_selector¶
def show_colormap_selector(label: str) -> boolIMPLOT_API bool ShowColormapSelector(const char* label);See it live: Config

Code from the demo
imgui.show_font_selector("Font")
imgui.show_style_selector("ImGui Style")
implot.show_style_selector("ImPlot Style")
implot.show_colormap_selector("ImPlot Colormap")Shows ImPlot colormap selector dropdown menu.
show_input_map_selector¶
def show_input_map_selector(label: str) -> boolIMPLOT_API bool ShowInputMapSelector(const char* label);See it live: Config

Code from the demo
imgui.show_style_selector("ImGui Style")
implot.show_style_selector("ImPlot Style")
implot.show_colormap_selector("ImPlot Colormap")
implot.show_input_map_selector("Input Map")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();See it live: Demo_Help

Code from the demo
imgui.text("USER GUIDE:")
implot.show_user_guide() # Assuming `show_user_guide()` exists in `imgui`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);See it live: Demo_Help

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);See it live: Plots › Heatmaps

Code from the demo
if implot.begin_plot("##Heatmap1", size=(225, 225), flags=implot.Flags_.no_legend | implot.Flags_.no_mouse_text):
implot.setup_axes("", "", axes_flags, axes_flags)
implot.setup_axis_ticks(implot.ImAxis_.x1, v_min=0 + 1.0 / 14.0, v_max=1 - 1.0 / 14.0, n_ticks=7, labels=static.xlabels, keep_default=False)
implot.setup_axis_ticks(implot.ImAxis_.y1, v_min=1 - 1.0 / 14.0, v_max=0 + 1.0 / 14.0, n_ticks=7, labels=static.ylabels, keep_default=False)
implot.plot_heatmap("heat", static.values1, scale_min=static.scale_min, scale_max=static.scale_max, label_fmt="%g",
bounds_min=implot.Point(0, 0), bounds_max=implot.Point(1, 1),
spec=implot.Spec(flags=static.hm_flags))
implot.end_plot()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.