ImPlot: 2D plots for Dear ImGui: lines, scatter, bars, shaded areas, heatmaps, histograms, pie charts, real-time data.
The C++ API of ImPlot: the signatures and the documentation of its headers. This page is generated by litgen, the engine behind the Python bindings of Dear ImGui Bundle. Functions without Python bindings are not listed.
Start with: ImPlot::BeginPlot, ImPlot::EndPlot, ImPlot::PlotLine, ImPlot::PlotScatter, ImPlot::SetupAxes.
implot.h¶
BoxedValue (struct)¶
struct BoxedValue| Member | |
|---|---|
double value; |
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
ImGui::DragFloat2("Limits Constraints", &constraints[0], 0.01f);
ImGui::DragFloat2("Zoom Constraints", &constraints[2], 0.01f);
CHECKBOX_FLAG(flags, ImPlotAxisFlags_PanStretch);
if (ImPlot::BeginPlot("##AxisConstraints",ImVec2(-1,0))) {
ImPlot::SetupAxes("X","Y",flags,flags);
ImPlot::SetupAxesLimits(-1,1,-1,1);
ImPlot::SetupAxisLimitsConstraints(ImAxis_X1,constraints[0], constraints[1]);
ImPlot::SetupAxisZoomConstraints(ImAxis_X1,constraints[2], constraints[3]);
ImPlot::SetupAxisLimitsConstraints(ImAxis_Y1,constraints[0], constraints[1]);
ImPlot::SetupAxisZoomConstraints(ImAxis_Y1,constraints[2], constraints[3]);
ImPlot::EndPlot();
}The type of its values in the API: typedef int ImAxis;
Axis indices. The values assigned may change; NEVER hardcode these.
| Member | Value | |
|---|---|---|
ImAxis_X1 = 0 | 0 | enabled by default |
ImAxis_X2 | 1 | disabled by default |
ImAxis_X3 | 2 | disabled by default |
ImAxis_Y1 | 3 | enabled by default |
ImAxis_Y2 | 4 | disabled by default |
ImAxis_Y3 | 5 | disabled by default |
ImAxis_COUNT | 6 |
ImPlotProp_ (enum)¶
enum ImPlotProp_Plotting properties. These provide syntactic sugar for creating ImPlotSpecs from (ImPlotProp,value) pairs. See ImPlotSpec documentation.
| Member | Value | |
|---|---|---|
ImPlotProp_LineColor | 0 | line color (applies to lines, bar edges); IMPLOT_AUTO_COL will use next Colormap color or current item color |
ImPlotProp_LineColors | 1 | array of colors for each line; if None, use LineColor for all lines |
ImPlotProp_LineWeight | 2 | line weight in pixels (applies to lines, bar edges, marker edges) |
ImPlotProp_FillColor | 3 | fill color (applies to shaded regions, bar faces); IMPLOT_AUTO_COL will use next Colormap color or current item color |
ImPlotProp_FillColors | 4 | array of colors for each fill; if None, use FillColor for all fills |
ImPlotProp_FillAlpha | 5 | alpha multiplier (applies to FillColor, FillColors, MarkerFillColor, and MarkerFillColors) |
ImPlotProp_Marker | 6 | marker type; specify ImPlotMarker_Auto to use the next unused marker |
ImPlotProp_MarkerSize | 7 | size of markers (radius) in pixels |
ImPlotProp_MarkerSizes | 8 | array of sizes for each marker; if None, use MarkerSize for all markers |
ImPlotProp_MarkerLineColor | 9 | marker edge color; IMPLOT_AUTO_COL will use LineColor |
ImPlotProp_MarkerLineColors | 10 | array of colors for each marker edge; if None, use MarkerLineColor for all markers |
ImPlotProp_MarkerFillColor | 11 | marker face color; IMPLOT_AUTO_COL will use LineColor |
ImPlotProp_MarkerFillColors | 12 | array of colors for each marker face; if None, use MarkerFillColor for all markers |
ImPlotProp_Size | 13 | size of error bar whiskers (width or height), and digital bars (height) in pixels |
ImPlotProp_Offset | 14 | data index offset |
ImPlotProp_Stride | 15 | data stride in bytes; IMPLOT_AUTO will result in sizeof(T) where T is the type passed to PlotX |
ImPlotProp_Flags | 16 | optional item flags; can be composed from common ImPlotItemFlags and/or specialized ImPlotXFlags |
ImPlotFlags_ (enum)¶
enum ImPlotFlags_The type of its values in the API: typedef int ImPlotFlags;
Options for plots (see BeginPlot).
| Member | Value | |
|---|---|---|
ImPlotFlags_None = 0 | 0 | default |
ImPlotFlags_NoTitle = 1 << 0 | 1 << 0 | the plot title will not be displayed (titles are also hidden if preceded by double hashes, e.g. “##MyPlot”) |
ImPlotFlags_NoLegend = 1 << 1 | 1 << 1 | the legend will not be displayed |
ImPlotFlags_NoMouseText = 1 << 2 | 1 << 2 | the mouse position, in plot coordinates, will not be displayed inside of the plot |
ImPlotFlags_NoInputs = 1 << 3 | 1 << 3 | the user will not be able to interact with the plot |
ImPlotFlags_NoMenus = 1 << 4 | 1 << 4 | the user will not be able to open context menus |
ImPlotFlags_NoBoxSelect = 1 << 5 | 1 << 5 | the user will not be able to box-select |
ImPlotFlags_NoFrame = 1 << 6 | 1 << 6 | the ImGui frame will not be rendered |
ImPlotFlags_Equal = 1 << 7 | 1 << 7 | x and y axes pairs will be constrained to have the same units/pixel |
ImPlotFlags_Crosshairs = 1 << 8 | 1 << 8 | the default mouse cursor will be replaced with a crosshair when hovered |
ImPlotFlags_CanvasOnly = ImPlotFlags_NoTitle | ImPlotFlags_NoLegend | ImPlotFlags_NoMenus | ImPlotFlags_NoBoxSelect | ImPlotFlags_NoMouseText | Flags_NoTitle | Flags_NoLegend | Flags_NoMenus | Flags_NoBoxSelect | Flags_NoMouseText |
ImPlotAxisFlags_ (enum)¶
enum ImPlotAxisFlags_The type of its values in the API: typedef int ImPlotAxisFlags;
Options for plot axes (see SetupAxis).
| Member | Value | |
|---|---|---|
ImPlotAxisFlags_None = 0 | 0 | default |
ImPlotAxisFlags_NoLabel = 1 << 0 | 1 << 0 | the axis label will not be displayed (axis labels are also hidden if the supplied string name is None) |
ImPlotAxisFlags_NoGridLines = 1 << 1 | 1 << 1 | no grid lines will be displayed |
ImPlotAxisFlags_NoTickMarks = 1 << 2 | 1 << 2 | no tick marks will be displayed |
ImPlotAxisFlags_NoTickLabels = 1 << 3 | 1 << 3 | no text labels will be displayed |
ImPlotAxisFlags_NoInitialFit = 1 << 4 | 1 << 4 | axis will not be initially fit to data extents on the first rendered frame |
ImPlotAxisFlags_NoMenus = 1 << 5 | 1 << 5 | the user will not be able to open context menus with right-click |
ImPlotAxisFlags_NoSideSwitch = 1 << 6 | 1 << 6 | the user will not be able to switch the axis side by dragging it |
ImPlotAxisFlags_NoHighlight = 1 << 7 | 1 << 7 | the axis will not have its background highlighted when hovered or held |
ImPlotAxisFlags_Opposite = 1 << 8 | 1 << 8 | axis ticks and labels will be rendered on the conventionally opposite side (i.e, right or top) |
ImPlotAxisFlags_Foreground = 1 << 9 | 1 << 9 | grid lines will be displayed in the foreground (i.e. on top of data) instead of the background |
ImPlotAxisFlags_Invert = 1 << 10 | 1 << 10 | the axis will be inverted |
ImPlotAxisFlags_AutoFit = 1 << 11 | 1 << 11 | axis will be auto-fitting to data extents |
ImPlotAxisFlags_RangeFit = 1 << 12 | 1 << 12 | axis will only fit points if the point is in the visible range of the orthogonal axis |
ImPlotAxisFlags_PanStretch = 1 << 13 | 1 << 13 | panning in a locked or constrained state will cause the axis to stretch if possible |
ImPlotAxisFlags_LockMin = 1 << 14 | 1 << 14 | the axis minimum value will be locked when panning/zooming |
ImPlotAxisFlags_LockMax = 1 << 15 | 1 << 15 | the axis maximum value will be locked when panning/zooming |
ImPlotAxisFlags_Lock = ImPlotAxisFlags_LockMin | ImPlotAxisFlags_LockMax | AxisFlags_LockMin | AxisFlags_LockMax | |
ImPlotAxisFlags_NoDecorations = ImPlotAxisFlags_NoLabel | ImPlotAxisFlags_NoGridLines | ImPlotAxisFlags_NoTickMarks | ImPlotAxisFlags_NoTickLabels | AxisFlags_NoLabel | AxisFlags_NoGridLines | AxisFlags_NoTickMarks | AxisFlags_NoTickLabels | |
ImPlotAxisFlags_AuxDefault = ImPlotAxisFlags_NoGridLines | ImPlotAxisFlags_Opposite | AxisFlags_NoGridLines | AxisFlags_Opposite |
ImPlotSubplotFlags_ (enum)¶
enum ImPlotSubplotFlags_The type of its values in the API: typedef int ImPlotSubplotFlags;
Options for subplots (see BeginSubplot)
| Member | Value | |
|---|---|---|
ImPlotSubplotFlags_None = 0 | 0 | default |
ImPlotSubplotFlags_NoTitle = 1 << 0 | 1 << 0 | the subplot title will not be displayed (titles are also hidden if preceded by double hashes, e.g. “##MySubplot”) |
ImPlotSubplotFlags_NoLegend = 1 << 1 | 1 << 1 | the legend will not be displayed (only applicable if ImPlotSubplotFlags_ShareItems is enabled) |
ImPlotSubplotFlags_NoMenus = 1 << 2 | 1 << 2 | the user will not be able to open context menus with right-click |
ImPlotSubplotFlags_NoResize = 1 << 3 | 1 << 3 | resize splitters between subplot cells will be not be provided |
ImPlotSubplotFlags_NoAlign = 1 << 4 | 1 << 4 | subplot edges will not be aligned vertically or horizontally |
ImPlotSubplotFlags_ShareItems = 1 << 5 | 1 << 5 | items across all subplots will be shared and rendered into a single legend entry |
ImPlotSubplotFlags_LinkRows = 1 << 6 | 1 << 6 | link the y-axis limits of all plots in each row (does not apply to auxiliary axes) |
ImPlotSubplotFlags_LinkCols = 1 << 7 | 1 << 7 | link the x-axis limits of all plots in each column (does not apply to auxiliary axes) |
ImPlotSubplotFlags_LinkAllX = 1 << 8 | 1 << 8 | link the x-axis limits in every plot in the subplot (does not apply to auxiliary axes) |
ImPlotSubplotFlags_LinkAllY = 1 << 9 | 1 << 9 | link the y-axis limits in every plot in the subplot (does not apply to auxiliary axes) |
ImPlotSubplotFlags_ColMajor = 1 << 10 | 1 << 10 | subplots are added in column major order instead of the default row major order |
ImPlotLegendFlags_ (enum)¶
enum ImPlotLegendFlags_The type of its values in the API: typedef int ImPlotLegendFlags;
Options for legends (see SetupLegend)
| Member | Value | |
|---|---|---|
ImPlotLegendFlags_None = 0 | 0 | default |
ImPlotLegendFlags_NoButtons = 1 << 0 | 1 << 0 | legend icons will not function as hide/show buttons |
ImPlotLegendFlags_NoHighlightItem = 1 << 1 | 1 << 1 | plot items will not be highlighted when their legend entry is hovered |
ImPlotLegendFlags_NoHighlightAxis = 1 << 2 | 1 << 2 | axes will not be highlighted when legend entries are hovered (only relevant if x/y-axis count > 1) |
ImPlotLegendFlags_NoMenus = 1 << 3 | 1 << 3 | the user will not be able to open context menus with right-click |
ImPlotLegendFlags_Outside = 1 << 4 | 1 << 4 | legend will be rendered outside of the plot area |
ImPlotLegendFlags_Horizontal = 1 << 5 | 1 << 5 | legend entries will be displayed horizontally |
ImPlotLegendFlags_Sort = 1 << 6 | 1 << 6 | legend entries will be displayed in alphabetical order |
ImPlotLegendFlags_Reverse = 1 << 7 | 1 << 7 | legend entries will be displayed in reverse order |
ImPlotMouseTextFlags_ (enum)¶
enum ImPlotMouseTextFlags_The type of its values in the API: typedef int ImPlotMouseTextFlags;
Options for mouse hover text (see SetupMouseText)
| Member | Value | |
|---|---|---|
ImPlotMouseTextFlags_None = 0 | 0 | default |
ImPlotMouseTextFlags_NoAuxAxes = 1 << 0 | 1 << 0 | only show the mouse position for primary axes |
ImPlotMouseTextFlags_NoFormat = 1 << 1 | 1 << 1 | axes label formatters won’t be used to render text |
ImPlotMouseTextFlags_ShowAlways = 1 << 2 | 1 << 2 | always display mouse position even if plot not hovered |
ImPlotDragToolFlags_ (enum)¶
enum ImPlotDragToolFlags_The type of its values in the API: typedef int ImPlotDragToolFlags;
Options for DragPoint, DragLine, DragRect
| Member | Value | |
|---|---|---|
ImPlotDragToolFlags_None = 0 | 0 | default |
ImPlotDragToolFlags_NoCursors = 1 << 0 | 1 << 0 | drag tools won’t change cursor icons when hovered or held |
ImPlotDragToolFlags_NoFit = 1 << 1 | 1 << 1 | the drag tool won’t be considered for plot fits |
ImPlotDragToolFlags_NoInputs = 1 << 2 | 1 << 2 | lock the tool from user inputs |
ImPlotDragToolFlags_Delayed = 1 << 3 | 1 << 3 | tool rendering will be delayed one frame; useful when applying position-constraints |
ImPlotColormapScaleFlags_ (enum)¶
enum ImPlotColormapScaleFlags_The type of its values in the API: typedef int ImPlotColormapScaleFlags;
Flags for ColormapScale
| Member | Value | |
|---|---|---|
ImPlotColormapScaleFlags_None = 0 | 0 | default |
ImPlotColormapScaleFlags_NoLabel = 1 << 0 | 1 << 0 | the colormap axis label will not be displayed |
ImPlotColormapScaleFlags_Opposite = 1 << 1 | 1 << 1 | render the colormap label and tick labels on the opposite side |
ImPlotColormapScaleFlags_Invert = 1 << 2 | 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) |
ImPlotItemFlags_ (enum)¶
enum ImPlotItemFlags_The type of its values in the API: typedef int ImPlotItemFlags;
Flags for ANY PlotX function. Used by setting ImPlotSpec::Flags.
| Member | Value | |
|---|---|---|
ImPlotItemFlags_None = 0 | 0 | |
ImPlotItemFlags_NoLegend = 1 << 0 | 1 << 0 | the item won’t have a legend entry displayed |
ImPlotItemFlags_NoFit = 1 << 1 | 1 << 1 | the item won’t be considered for plot fits |
ImPlotLineFlags_ (enum)¶
enum ImPlotLineFlags_The type of its values in the API: typedef int ImPlotLineFlags;
Flags for PlotLine. Used by setting ImPlotSpec::Flags.
| Member | Value | |
|---|---|---|
ImPlotLineFlags_None = 0 | 0 | default |
ImPlotLineFlags_Segments = 1 << 10 | 1 << 10 | a line segment will be rendered from every two consecutive points |
ImPlotLineFlags_Loop = 1 << 11 | 1 << 11 | the last and first point will be connected to form a closed loop |
ImPlotLineFlags_SkipNaN = 1 << 12 | 1 << 12 | NaNs values will be skipped instead of rendered as missing data |
ImPlotLineFlags_NoClip = 1 << 13 | 1 << 13 | markers (if displayed) on the edge of a plot will not be clipped |
ImPlotLineFlags_Shaded = 1 << 14 | 1 << 14 | a filled region between the line and horizontal origin will be rendered; use PlotShaded for more advanced cases |
ImPlotScatterFlags_ (enum)¶
enum ImPlotScatterFlags_The type of its values in the API: typedef int ImPlotScatterFlags;
Flags for PlotScatter. Used by setting ImPlotSpec::Flags.
| Member | Value | |
|---|---|---|
ImPlotScatterFlags_None = 0 | 0 | default |
ImPlotScatterFlags_NoClip = 1 << 10 | 1 << 10 | markers on the edge of a plot will not be clipped |
ImPlotBubblesFlags_ (enum)¶
enum ImPlotBubblesFlags_Flags for PlotBubbles. Used by setting ImPlotSpec::Flags.
| Member | Value | |
|---|---|---|
ImPlotBubblesFlags_None = 0 | 0 | default |
ImPlotPolygonFlags_ (enum)¶
enum ImPlotPolygonFlags_Flags for PlotPolygon. Used by setting ImPlotSpec::Flags.
| Member | Value | |
|---|---|---|
ImPlotPolygonFlags_None = 0 | 0 | default (closed, convex polygon) |
ImPlotPolygonFlags_Concave = 1 << 10 | 1 << 10 | use concave polygon filling (slower but supports concave shapes) |
ImPlotStairsFlags_ (enum)¶
enum ImPlotStairsFlags_The type of its values in the API: typedef int ImPlotStairsFlags;
Flags for PlotStairs. Used by setting ImPlotSpec::Flags.
| Member | Value | |
|---|---|---|
ImPlotStairsFlags_None = 0 | 0 | default |
ImPlotStairsFlags_PreStep = 1 << 10 | 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] |
ImPlotStairsFlags_Shaded = 1 << 11 | 1 << 11 | a filled region between the stairs and horizontal origin will be rendered; use PlotShaded for more advanced cases |
ImPlotShadedFlags_ (enum)¶
enum ImPlotShadedFlags_The type of its values in the API: typedef int ImPlotShadedFlags;
Flags for PlotShaded (placeholder). Used by setting ImPlotSpec::Flags.
| Member | Value | |
|---|---|---|
ImPlotShadedFlags_None = 0 | 0 | default |
ImPlotBarsFlags_ (enum)¶
enum ImPlotBarsFlags_The type of its values in the API: typedef int ImPlotBarsFlags;
Flags for PlotBars. Used by setting ImPlotSpec::Flags.
| Member | Value | |
|---|---|---|
ImPlotBarsFlags_None = 0 | 0 | default |
ImPlotBarsFlags_Horizontal = 1 << 10 | 1 << 10 | bars will be rendered horizontally on the current y-axis |
ImPlotBarGroupsFlags_ (enum)¶
enum ImPlotBarGroupsFlags_The type of its values in the API: typedef int ImPlotBarGroupsFlags;
Flags for PlotBarGroups. Used by setting ImPlotSpec::Flags.
| Member | Value | |
|---|---|---|
ImPlotBarGroupsFlags_None = 0 | 0 | default |
ImPlotBarGroupsFlags_Horizontal = 1 << 10 | 1 << 10 | bar groups will be rendered horizontally on the current y-axis |
ImPlotBarGroupsFlags_Stacked = 1 << 11 | 1 << 11 | items in a group will be stacked on top of each other |
ImPlotErrorBarsFlags_ (enum)¶
enum ImPlotErrorBarsFlags_The type of its values in the API: typedef int ImPlotErrorBarsFlags;
Flags for PlotErrorBars. Used by setting ImPlotSpec::Flags.
| Member | Value | |
|---|---|---|
ImPlotErrorBarsFlags_None = 0 | 0 | default |
ImPlotErrorBarsFlags_Horizontal = 1 << 10 | 1 << 10 | error bars will be rendered horizontally on the current y-axis |
ImPlotStemsFlags_ (enum)¶
enum ImPlotStemsFlags_The type of its values in the API: typedef int ImPlotStemsFlags;
Flags for PlotStems. Used by setting ImPlotSpec::Flags.
| Member | Value | |
|---|---|---|
ImPlotStemsFlags_None = 0 | 0 | default |
ImPlotStemsFlags_Horizontal = 1 << 10 | 1 << 10 | stems will be rendered horizontally on the current y-axis |
ImPlotInfLinesFlags_ (enum)¶
enum ImPlotInfLinesFlags_The type of its values in the API: typedef int ImPlotInfLinesFlags;
Flags for PlotInfLines. Used by setting ImPlotSpec::Flags.
| Member | Value | |
|---|---|---|
ImPlotInfLinesFlags_None = 0 | 0 | default |
ImPlotInfLinesFlags_Horizontal = 1 << 10 | 1 << 10 | lines will be rendered horizontally on the current y-axis |
ImPlotPieChartFlags_ (enum)¶
enum ImPlotPieChartFlags_The type of its values in the API: typedef int ImPlotPieChartFlags;
Flags for PlotPieChart. Used by setting ImPlotSpec::Flags.
| Member | Value | |
|---|---|---|
ImPlotPieChartFlags_None = 0 | 0 | default |
ImPlotPieChartFlags_Normalize = 1 << 10 | 1 << 10 | force normalization of pie chart values (i.e. always make a full circle if sum < 0) |
ImPlotPieChartFlags_IgnoreHidden = 1 << 11 | 1 << 11 | ignore hidden slices when drawing the pie chart (as if they were not there) |
ImPlotPieChartFlags_Exploding = 1 << 12 | 1 << 12 | explode legend-hovered slice |
ImPlotPieChartFlags_NoSliceBorder = 1 << 13 | 1 << 13 | do not draw slice borders |
ImPlotHeatmapFlags_ (enum)¶
enum ImPlotHeatmapFlags_The type of its values in the API: typedef int ImPlotHeatmapFlags;
Flags for PlotHeatmap. Used by setting ImPlotSpec::Flags.
| Member | Value | |
|---|---|---|
ImPlotHeatmapFlags_None = 0 | 0 | default |
ImPlotHeatmapFlags_ColMajor = 1 << 10 | 1 << 10 | data will be read in column major order |
ImPlotHistogramFlags_ (enum)¶
enum ImPlotHistogramFlags_The type of its values in the API: typedef int ImPlotHistogramFlags;
Flags for PlotHistogram and PlotHistogram2D. Used by setting ImPlotSpec::Flags.
| Member | Value | |
|---|---|---|
ImPlotHistogramFlags_None = 0 | 0 | default |
ImPlotHistogramFlags_Horizontal = 1 << 10 | 1 << 10 | histogram bars will be rendered horizontally (not supported by PlotHistogram2D) |
ImPlotHistogramFlags_Cumulative = 1 << 11 | 1 << 11 | each bin will contain its count plus the counts of all previous bins (not supported by PlotHistogram2D) |
ImPlotHistogramFlags_Density = 1 << 12 | 1 << 12 | counts will be normalized, i.e. the PDF will be visualized, or the CDF will be visualized if Cumulative is also set |
ImPlotHistogramFlags_NoOutliers = 1 << 13 | 1 << 13 | exclude values outside the specified histogram range from the count toward normalizing and cumulative counts |
ImPlotHistogramFlags_ColMajor = 1 << 14 | 1 << 14 | data will be read in column major order (not supported by PlotHistogram) |
ImPlotDigitalFlags_ (enum)¶
enum ImPlotDigitalFlags_The type of its values in the API: typedef int ImPlotDigitalFlags;
Flags for PlotDigital (placeholder). Used by setting ImPlotSpec::Flags.
| Member | Value | |
|---|---|---|
ImPlotDigitalFlags_None = 0 | 0 | default |
ImPlotImageFlags_ (enum)¶
enum ImPlotImageFlags_The type of its values in the API: typedef int ImPlotImageFlags;
Flags for PlotImage (placeholder). Used by setting ImPlotSpec::Flags.
| Member | Value | |
|---|---|---|
ImPlotImageFlags_None = 0 | 0 | default |
ImPlotTextFlags_ (enum)¶
enum ImPlotTextFlags_The type of its values in the API: typedef int ImPlotTextFlags;
Flags for PlotText. Used by setting ImPlotSpec::Flags.
| Member | Value | |
|---|---|---|
ImPlotTextFlags_None = 0 | 0 | default |
ImPlotTextFlags_Vertical = 1 << 10 | 1 << 10 | text will be rendered vertically |
ImPlotDummyFlags_ (enum)¶
enum ImPlotDummyFlags_The type of its values in the API: typedef int ImPlotDummyFlags;
Flags for PlotDummy (placeholder). Used by setting ImPlotSpec::Flags.
| Member | Value | |
|---|---|---|
ImPlotDummyFlags_None = 0 | 0 | default |
ImPlotCond_ (enum)¶
enum ImPlotCond_The type of its values in the API: typedef int ImPlotCond;
Represents a condition for SetupAxisLimits etc. (same as ImGuiCond, but we only support a subset of those enums)
| Member | Value | |
|---|---|---|
ImPlotCond_None = ImGuiCond_None | Cond_None | No condition (always set the variable), same as _Always |
ImPlotCond_Always = ImGuiCond_Always | Cond_Always | No condition (always set the variable) |
ImPlotCond_Once = ImGuiCond_Once | Cond_Once | Set the variable once per runtime session (only the first call will succeed) |
ImPlotCol_ (enum)¶
enum ImPlotCol_The type of its values in the API: typedef int ImPlotCol;
Plot styling colors.
| Member | Value | |
|---|---|---|
ImPlotCol_FrameBg | 0 | plot frame background color (defaults to ImGuiCol_FrameBg) |
ImPlotCol_PlotBg | 1 | plot area background color (defaults to ImGuiCol_WindowBg) |
ImPlotCol_PlotBorder | 2 | plot area border color (defaults to ImGuiCol_Border) |
ImPlotCol_LegendBg | 3 | legend background color (defaults to ImGuiCol_PopupBg) |
ImPlotCol_LegendBorder | 4 | legend border color (defaults to ImPlotCol_PlotBorder) |
ImPlotCol_LegendText | 5 | legend text color (defaults to ImPlotCol_InlayText) |
ImPlotCol_TitleText | 6 | plot title text color (defaults to ImGuiCol_Text) |
ImPlotCol_InlayText | 7 | color of text appearing inside of plots (defaults to ImGuiCol_Text) |
ImPlotCol_AxisText | 8 | axis label and tick labels color (defaults to ImGuiCol_Text) |
ImPlotCol_AxisGrid | 9 | axis grid color (defaults to 25% ImPlotCol_AxisText) |
ImPlotCol_AxisTick | 10 | axis tick color (defaults to AxisGrid) |
ImPlotCol_AxisBg | 11 | background color of axis hover region (defaults to transparent) |
ImPlotCol_AxisBgHovered | 12 | axis hover color (defaults to ImGuiCol_ButtonHovered) |
ImPlotCol_AxisBgActive | 13 | axis active color (defaults to ImGuiCol_ButtonActive) |
ImPlotCol_Selection | 14 | box-selection color (defaults to yellow) |
ImPlotCol_Crosshairs | 15 | crosshairs color (defaults to ImPlotCol_PlotBorder) |
ImPlotCol_COUNT | 16 |
ImPlotStyleVar_ (enum)¶
enum ImPlotStyleVar_The type of its values in the API: typedef int ImPlotStyleVar;
Plot styling variables.
| Member | Value | |
|---|---|---|
ImPlotStyleVar_PlotDefaultSize | 0 | ImVec2, default size used when ImVec2(0,0) is passed to BeginPlot |
ImPlotStyleVar_PlotMinSize | 1 | ImVec2, minimum size plot frame can be when shrunk |
ImPlotStyleVar_PlotBorderSize | 2 | float, thickness of border around plot area |
ImPlotStyleVar_MinorAlpha | 3 | float, alpha multiplier applied to minor axis grid lines |
ImPlotStyleVar_MajorTickLen | 4 | ImVec2, major tick lengths for X and Y axes |
ImPlotStyleVar_MinorTickLen | 5 | ImVec2, minor tick lengths for X and Y axes |
ImPlotStyleVar_MajorTickSize | 6 | ImVec2, line thickness of major ticks |
ImPlotStyleVar_MinorTickSize | 7 | ImVec2, line thickness of minor ticks |
ImPlotStyleVar_MajorGridSize | 8 | ImVec2, line thickness of major grid lines |
ImPlotStyleVar_MinorGridSize | 9 | ImVec2, line thickness of minor grid lines |
ImPlotStyleVar_PlotPadding | 10 | ImVec2, padding between widget frame and plot area, labels, or outside legends (i.e. main padding) |
ImPlotStyleVar_LabelPadding | 11 | ImVec2, padding between axes labels, tick labels, and plot edge |
ImPlotStyleVar_LegendPadding | 12 | ImVec2, legend padding from plot edges |
ImPlotStyleVar_LegendInnerPadding | 13 | ImVec2, legend inner padding from legend edges |
ImPlotStyleVar_LegendSpacing | 14 | ImVec2, spacing between legend entries |
ImPlotStyleVar_MousePosPadding | 15 | ImVec2, padding between plot edge and interior info text |
ImPlotStyleVar_AnnotationPadding | 16 | ImVec2, text padding around annotation labels |
ImPlotStyleVar_FitPadding | 17 | 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) |
ImPlotStyleVar_DigitalPadding | 18 | float, digital plot padding from bottom in pixels |
ImPlotStyleVar_DigitalSpacing | 19 | float, digital plot spacing gap in pixels |
ImPlotStyleVar_COUNT | 20 |
ImPlotScale_ (enum)¶
enum ImPlotScale_See it live: Axes › Log Scale (also used in 4 other sections)

Code from the demo
if (ImPlot::BeginPlot("Log Plot", ImVec2(-1,0))) {
ImPlot::SetupAxisScale(ImAxis_X1, ImPlotScale_Log10);
ImPlot::SetupAxesLimits(0.1, 100, 0, 10);
ImPlot::PlotLine("f(x) = x", xs, xs, 1001);
ImPlot::PlotLine("f(x) = sin(x)+1", xs, ys1, 1001);
ImPlot::PlotLine("f(x) = log(x)", xs, ys2, 1001);
ImPlot::PlotLine("f(x) = 10^x", xs, ys3, 21);
ImPlot::EndPlot();
}The type of its values in the API: typedef int ImPlotScale;
Axis scale
| Member | Value | |
|---|---|---|
ImPlotScale_Linear = 0 | 0 | default linear scale |
ImPlotScale_Time | 1 | date/time scale |
ImPlotScale_Log10 | 2 | base 10 logarithmic scale |
ImPlotScale_SymLog | 3 | symmetric log scale |
ImPlotMarker_ (enum)¶
enum ImPlotMarker_See it live: Plots › Markers and Text (also used in 12 other sections)

Code from the demo
static ImPlotSpec spec(ImPlotProp_Marker, ImPlotMarker_Auto);The type of its values in the API: typedef int ImPlotMarker;
Marker specifications.
| Member | Value | |
|---|---|---|
ImPlotMarker_None = -2 | -2 | no marker |
ImPlotMarker_Auto = -1 | -1 | automatic marker selection |
ImPlotMarker_Circle | 0 | a circle marker (default) |
ImPlotMarker_Square | 1 | a square maker |
ImPlotMarker_Diamond | 2 | a diamond marker |
ImPlotMarker_Up | 3 | an upward-pointing triangle marker |
ImPlotMarker_Down | 4 | an downward-pointing triangle marker |
ImPlotMarker_Left | 5 | an leftward-pointing triangle marker |
ImPlotMarker_Right | 6 | an rightward-pointing triangle marker |
ImPlotMarker_Cross | 7 | a cross marker (not fill-able) |
ImPlotMarker_Plus | 8 | a plus marker (not fill-able) |
ImPlotMarker_Asterisk | 9 | a asterisk marker (not fill-able) |
ImPlotMarker_Vertical | 10 | a vertical line marker (not fill-able) |
ImPlotMarker_Horizontal | 11 | a horizontal line marker (not fill-able) |
ImPlotMarker_COUNT | 12 |
ImPlotColormap_ (enum)¶
enum ImPlotColormap_See it live: Tools › Colormap Widgets (also used in 14 other sections)

Code from the demo
static int cmap = ImPlotColormap_Viridis;The type of its values in the API: typedef int ImPlotColormap;
Built-in colormaps
| Member | Value | |
|---|---|---|
ImPlotColormap_Deep = 0 | 0 | a.k.a. seaborn deep (qual=True, n=10) (default) |
ImPlotColormap_Dark = 1 | 1 | a.k.a. matplotlib “Set1” (qual=True, n=9 ) |
ImPlotColormap_Pastel = 2 | 2 | a.k.a. matplotlib “Pastel1” (qual=True, n=9 ) |
ImPlotColormap_Paired = 3 | 3 | a.k.a. matplotlib “Paired” (qual=True, n=12) |
ImPlotColormap_Viridis = 4 | 4 | a.k.a. matplotlib “viridis” (qual=False, n=11) |
ImPlotColormap_Plasma = 5 | 5 | a.k.a. matplotlib “plasma” (qual=False, n=11) |
ImPlotColormap_Hot = 6 | 6 | a.k.a. matplotlib/MATLAB “hot” (qual=False, n=11) |
ImPlotColormap_Cool = 7 | 7 | a.k.a. matplotlib/MATLAB “cool” (qual=False, n=11) |
ImPlotColormap_Pink = 8 | 8 | a.k.a. matplotlib/MATLAB “pink” (qual=False, n=11) |
ImPlotColormap_Jet = 9 | 9 | a.k.a. MATLAB “jet” (qual=False, n=11) |
ImPlotColormap_Twilight = 10 | 10 | a.k.a. matplotlib “twilight” (qual=False, n=11) |
ImPlotColormap_RdBu = 11 | 11 | red/blue, Color Brewer (qual=False, n=11) |
ImPlotColormap_BrBG = 12 | 12 | brown/blue-green, Color Brewer (qual=False, n=11) |
ImPlotColormap_PiYG = 13 | 13 | pink/yellow-green, Color Brewer (qual=False, n=11) |
ImPlotColormap_Spectral = 14 | 14 | color spectrum, Color Brewer (qual=False, n=11) |
ImPlotColormap_Greys = 15 | 15 | white/black (qual=False, n=2 ) |
ImPlotLocation_ (enum)¶
enum ImPlotLocation_The type of its values in the API: typedef int ImPlotLocation;
Used to position items on a plot (e.g. legends, labels, etc.)
| Member | Value | |
|---|---|---|
ImPlotLocation_Center = 0 | 0 | center-center |
ImPlotLocation_North = 1 << 0 | 1 << 0 | top-center |
ImPlotLocation_South = 1 << 1 | 1 << 1 | bottom-center |
ImPlotLocation_West = 1 << 2 | 1 << 2 | center-left |
ImPlotLocation_East = 1 << 3 | 1 << 3 | center-right |
ImPlotLocation_NorthWest = ImPlotLocation_North | ImPlotLocation_West | Location_North | Location_West | top-left |
ImPlotLocation_NorthEast = ImPlotLocation_North | ImPlotLocation_East | Location_North | Location_East | top-right |
ImPlotLocation_SouthWest = ImPlotLocation_South | ImPlotLocation_West | Location_South | Location_West | bottom-left |
ImPlotLocation_SouthEast = ImPlotLocation_South | ImPlotLocation_East | Location_South | Location_East | bottom-right |
ImPlotBin_ (enum)¶
enum ImPlotBin_The type of its values in the API: typedef int ImPlotBin;
Enums for different automatic histogram binning methods (k = bin count or w = bin width)
| Member | Value | |
|---|---|---|
ImPlotBin_Sqrt = -1 | -1 | k = sqrt(n) |
ImPlotBin_Sturges = -2 | -2 | k = 1 + log2(n) |
ImPlotBin_Rice = -3 | -3 | k = 2 * cbrt(n) |
ImPlotBin_Scott = -4 | -4 | w = 3.49 * sigma / cbrt(n) |
ImPlotSpec (struct)¶
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
});| Member | |
|---|---|
ImVec4 LineColor = IMPLOT_AUTO_COL; | line color (applies to lines, bar edges); IMPLOT_AUTO_COL will use next Colormap color or current item color |
float LineWeight = 1.0f; | line weight in pixels (applies to lines, bar edges, marker edges) |
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 |
float FillAlpha = 1.0f; | alpha multiplier (applies to FillColor, FillColors, MarkerFillColor, and MarkerFillColors) |
ImPlotMarker Marker = ImPlotMarker_None; | marker type; specify ImPlotMarker_Auto to use the next unused marker |
float MarkerSize = 4; | size of markers (radius) in pixels |
ImVec4 MarkerLineColor = IMPLOT_AUTO_COL; | marker edge color; IMPLOT_AUTO_COL will use LineColor |
ImVec4 MarkerFillColor = IMPLOT_AUTO_COL; | marker face color; IMPLOT_AUTO_COL will use LineColor |
float Size = 4; | size of error bar whiskers (width or height), and digital bars (height) in pixels |
int Offset = 0; | data index offset |
int Stride = IMPLOT_AUTO; | data stride in bytes; IMPLOT_AUTO will result in sizeof(T) where T is the type passed to PlotX |
ImPlotItemFlags Flags = ImPlotItemFlags_None; | optional item flags; can be composed from common ImPlotItemFlags and/or specialized ImPlotXFlags |
| `` | array of colors (np.uint32) for each line. Must have the same length as the data arrays. If None, use LineColor for all lines. |
| `` | array of colors (np.uint32) for each fill. Must have the same length as the data arrays. If None, use FillColor for all fills. |
| `` | 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. |
| `` | 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. |
| `` | array of sizes (np.float32) for each marker. Must have the same length as the data arrays. If None, use MarkerSize for all markers. |
ImPlotPoint (struct)¶
struct ImPlotPointSee it live: Tools › Drag Points (also used in 3 other sections)

Code from the demo
bool clicked[4] = {false, false, false, false};
bool hovered[4] = {false, false, false, false};
bool held[4] = {false, false, false, false};
if (ImPlot::BeginPlot("##Bezier",ImVec2(-1,0),ImPlotFlags_CanvasOnly)) {
ImPlot::SetupAxes(nullptr,nullptr,ax_flags,ax_flags);
ImPlot::SetupAxesLimits(0,1,0,1);
static ImPlotPoint P[] = {ImPlotPoint(.05f,.05f), ImPlotPoint(0.2,0.4), ImPlotPoint(0.8,0.6), ImPlotPoint(.95f,.95f)};
ImPlot::DragPoint(0,&P[0].x,&P[0].y, ImVec4(0,0.9f,0,1),4,flags, &clicked[0], &hovered[0], &held[0]);
ImPlot::DragPoint(1,&P[1].x,&P[1].y, ImVec4(1,0.5f,1,1),4,flags, &clicked[1], &hovered[1], &held[1]);
ImPlot::DragPoint(2,&P[2].x,&P[2].y, ImVec4(0,0.5f,1,1),4,flags, &clicked[2], &hovered[2], &held[2]);
ImPlot::DragPoint(3,&P[3].x,&P[3].y, ImVec4(0,0.9f,0,1),4,flags, &clicked[3], &hovered[3], &held[3]);
static ImPlotPoint B[100];
...| Member | |
|---|---|
double x, | |
y; |
ImPlotPoint::ImPlotPoint¶
constexpr 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)

Code from the demo
bool clicked[4] = {false, false, false, false};
bool hovered[4] = {false, false, false, false};
bool held[4] = {false, false, false, false};
if (ImPlot::BeginPlot("##Bezier",ImVec2(-1,0),ImPlotFlags_CanvasOnly)) {
ImPlot::SetupAxes(nullptr,nullptr,ax_flags,ax_flags);
ImPlot::SetupAxesLimits(0,1,0,1);
static ImPlotPoint P[] = {ImPlotPoint(.05f,.05f), ImPlotPoint(0.2,0.4), ImPlotPoint(0.8,0.6), ImPlotPoint(.95f,.95f)};
ImPlot::DragPoint(0,&P[0].x,&P[0].y, ImVec4(0,0.9f,0,1),4,flags, &clicked[0], &hovered[0], &held[0]);
ImPlot::DragPoint(1,&P[1].x,&P[1].y, ImVec4(1,0.5f,1,1),4,flags, &clicked[1], &hovered[1], &held[1]);
ImPlot::DragPoint(2,&P[2].x,&P[2].y, ImVec4(0,0.5f,1,1),4,flags, &clicked[2], &hovered[2], &held[2]);
ImPlot::DragPoint(3,&P[3].x,&P[3].y, ImVec4(0,0.9f,0,1),4,flags, &clicked[3], &hovered[3], &held[3]);
static ImPlotPoint B[100];
...ImPlotRange (struct)¶
struct ImPlotRangeRange defined by a min/max value.
| Member | |
|---|---|
double Min, | |
Max; |
ImPlotRange::ImPlotRange¶
constexpr ImPlotRange() : Min(0.0), Max(0.0);constexpr ImPlotRange(double _min, double _max) : Min(_min), Max(_max);ImPlotRange::Contains¶
IMPLOT_API bool Contains(double value) const;ImPlotRange::Size¶
IMPLOT_API double Size() const;ImPlotRange::Clamp¶
IMPLOT_API double Clamp(double value) const;ImPlotRect (struct)¶
struct ImPlotRectSee it live: Tools › Drag Rects (also used in 3 other sections)

Code from the demo
ImGui::BulletText("Click and drag the edges, corners, and center of the rect.");
ImGui::BulletText("Double click edges to expand rect to plot extents.");
static ImPlotRect rect(0.0025,0.0045,0,0.5);Combination of two range limits for X and Y axes. Also an AABB defined by Min()/Max().
| Member | |
|---|---|
ImPlotRange X, | |
Y; |
ImPlotRect::ImPlotRect¶
constexpr 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);ImPlotRect::Contains¶
IMPLOT_API bool Contains(const ImPlotPoint& p) const;IMPLOT_API bool Contains(double x, double y) const;ImPlotRect::Size¶
IMPLOT_API ImPlotPoint Size() const;ImPlotRect::Clamp¶
IMPLOT_API ImPlotPoint Clamp(const ImPlotPoint& p) const;IMPLOT_API ImPlotPoint Clamp(double x, double y) const;ImPlotRect::Min¶
IMPLOT_API ImPlotPoint Min() const;ImPlotRect::Max¶
IMPLOT_API ImPlotPoint Max() const;ImPlotStyle (struct)¶
struct ImPlotStylePlot style structure (has support for copy.copy)
| Member | |
|---|---|
ImVec2 PlotDefaultSize; | = 400,300 default size used when ImVec2(0,0) is passed to BeginPlot |
ImVec2 PlotMinSize; | = 200,150 minimum size plot frame can be when shrunk |
float PlotBorderSize; | = 1, line thickness of border around plot area |
float MinorAlpha; | = 0.25 alpha multiplier applied to minor axis grid lines |
ImVec2 MajorTickLen; | = 10,10 major tick lengths for X and Y axes |
ImVec2 MinorTickLen; | = 5,5 minor tick lengths for X and Y axes |
ImVec2 MajorTickSize; | = 1,1 line thickness of major ticks |
ImVec2 MinorTickSize; | = 1,1 line thickness of minor ticks |
ImVec2 MajorGridSize; | = 1,1 line thickness of major grid lines |
ImVec2 MinorGridSize; | = 1,1 line thickness of minor grid lines |
ImVec2 PlotPadding; | = 10,10 padding between widget frame and plot area, labels, or outside legends (i.e. main padding) |
ImVec2 LabelPadding; | = 5,5 padding between axes labels, tick labels, and plot edge |
ImVec2 LegendPadding; | = 10,10 legend padding from plot edges |
ImVec2 LegendInnerPadding; | = 5,5 legend inner padding from legend edges |
ImVec2 LegendSpacing; | = 5,0 spacing between legend entries |
ImVec2 MousePosPadding; | = 10,10 padding between plot edge and interior mouse location text |
ImVec2 AnnotationPadding; | = 2,2 text padding around annotation labels |
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) |
float DigitalPadding; | = 20, digital plot padding from bottom in pixels |
float DigitalSpacing; | = 4, digital plot spacing gap in pixels |
ImPlotColormap Colormap; | The current colormap. Set this to either an ImPlotColormap_ enum or an index returned by AddColormap. |
bool UseLocalTime; | = False, axis labels will be formatted for your timezone when ImPlotAxisFlag_Time is enabled |
bool UseISO8601; | = False, dates will be formatted according to ISO 8601 where applicable (e.g. YYYY-MM-DD, YYYY-MM, --MM-DD, etc.) |
bool Use24HourClock; | = False, times will be formatted using a 24 hour clock |
ImPlotStyle::Color_¶
inline IMPLOT_API ImVec4& Color_(size_t idxColor);Array of styling colors (index from implot.Col_.xxx)
ImPlotStyle::SetColor_¶
inline IMPLOT_API void SetColor_(size_t idxColor, ImVec4 color);Array of styling colors (index from implot.Col_.xxx)
ImPlotStyle::ImPlotStyle¶
IMPLOT_API ImPlotStyle();Support for legacy versions¶
ImPlotInputMap (struct)¶
struct ImPlotInputMapInput mapping structure. Default values listed. See also MapInputDefault, MapInputReverse.
| Member | |
|---|---|
ImGuiMouseButton Pan; | LMB enables panning when held, |
int PanMod; | none optional modifier that must be held for panning/fitting |
ImGuiMouseButton Fit; | LMB initiates fit when double clicked |
ImGuiMouseButton Select; | RMB begins box selection when pressed and confirms selection when released |
ImGuiMouseButton SelectCancel; | LMB cancels active box selection when pressed; cannot be same as Select |
int SelectMod; | none optional modifier that must be held for box selection |
int SelectHorzMod; | Alt expands active box selection horizontally to plot edge when held |
int SelectVertMod; | Shift expands active box selection vertically to plot edge when held |
ImGuiMouseButton Menu; | RMB opens context menus (if enabled) when clicked |
int OverrideMod; | Ctrl when held, all input is ignored; used to enable axis/plots as DND sources |
int ZoomMod; | none optional modifier that must be held for scroll wheel zooming |
float ZoomRate; | 0.1 zoom rate for scroll (e.g. 0.1 = 10% plot range every scroll click); make negative to invert |
ImPlotInputMap::ImPlotInputMap¶
IMPLOT_API ImPlotInputMap();Contexts¶
ImPlot::CreateContext¶
IMPLOT_API ImPlotContext* CreateContext();Creates a new ImPlot context. Call this after ImGui::CreateContext.
ImPlot::DestroyContext¶
IMPLOT_API void DestroyContext(ImPlotContext* ctx = nullptr);Destroys an ImPlot context. Call this before ImGui::DestroyContext. None = destroy current context.
ImPlot::GetCurrentContext¶
IMPLOT_API ImPlotContext* GetCurrentContext();Returns the current ImPlot context. None if no context has ben set.
ImPlot::SetCurrentContext¶
IMPLOT_API void SetCurrentContext(ImPlotContext* ctx);Sets the current ImPlot context.
ImPlot::SetImGuiContext¶
IMPLOT_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¶
ImPlot::BeginPlot¶
IMPLOT_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::BeginPlot("Line Plots")) {
ImPlot::SetupAxes("x","y");
ImPlot::PlotLine("f(x)", xs1, ys1, 1001);
ImPlot::PlotLine("g(x)", xs2, ys2, 20,{
ImPlotProp_Marker, ImPlotMarker_Circle,
ImPlotProp_Flags, ImPlotLineFlags_Segments
});
ImPlot::EndPlot();
}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.
ImPlot::EndPlot¶
IMPLOT_API void EndPlot();See it live: Plots › Line Plots (also used in 56 other sections)

Code from the demo
if (ImPlot::BeginPlot("Line Plots")) {
ImPlot::SetupAxes("x","y");
ImPlot::PlotLine("f(x)", xs1, ys1, 1001);
ImPlot::PlotLine("g(x)", xs2, ys2, 20,{
ImPlotProp_Marker, ImPlotMarker_Circle,
ImPlotProp_Flags, ImPlotLineFlags_Segments
});
ImPlot::EndPlot();
}Only call EndPlot() if BeginPlot() returns True! Typically called at the end of an if statement conditioned on BeginPlot(). See example above.
Begin/End Subplots¶
SubplotsRowColRatios (struct)¶
struct SubplotsRowColRatios| Member | |
|---|---|
std::vector<float> row_ratios; | |
std::vector<float> col_ratios; |
ImPlot::BeginSubplotsWithRatios¶
IMPLOT_API inline bool BeginSubplotsWithRatios(const char* title_id, int rows, int cols, const ImVec2& size, ImPlotSubplotFlags flags = 0, SubplotsRowColRatios* row_col_ratios = nullptr);ImPlot::EndSubplots¶
IMPLOT_API void EndSubplots();See it live: Subplots › Sizing (also used in 2 other sections)

Code from the demo
ImPlot::EndSubplots();Only call EndSubplots() if BeginSubplots() returns True! Typically called at the end of an if statement conditioned on BeginSubplots(). See example above.
Setup¶
ImPlot::SetupAxis¶
IMPLOT_API void SetupAxis(ImAxis axis, const char* label=nullptr, ImPlotAxisFlags flags=0);See it live: Axes › Custom Scale (also used in 5 other sections)

Code from the demo
if (ImPlot::BeginPlot("Sqrt")) {
ImPlot::SetupAxis(ImAxis_X1, "Linear");
ImPlot::SetupAxis(ImAxis_Y1, "Sqrt");
ImPlot::SetupAxisScale(ImAxis_Y1, TransformForward_Sqrt, TransformInverse_Sqrt);
ImPlot::SetupAxisLimitsConstraints(ImAxis_Y1, 0, INFINITY);
ImPlot::PlotLine("##data",v,v,100);
ImPlot::EndPlot();
}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.
ImPlot::SetupAxisLimits¶
IMPLOT_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::BeginPlot("Stem Plots")) {
ImPlot::SetupAxisLimits(ImAxis_X1,0,1.0);
ImPlot::SetupAxisLimits(ImAxis_Y1,0,1.6);
ImPlot::PlotStems("Stems 1",xs,ys1,51);
ImPlot::PlotStems("Stems 2", xs, ys2,51, 0, {ImPlotProp_Marker, ImPlotMarker_Circle});
ImPlot::EndPlot();
}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.
ImPlot::SetupAxisLinks¶
IMPLOT_API inline void SetupAxisLinks(ImAxis axis, BoxedValue* link_min, BoxedValue* link_max);See it live: Axes › Linked Axes

Code from the demo
if (ImPlot::BeginPlot("Plot A")) {
ImPlot::SetupAxisLinks(ImAxis_X1, linkx ? &lims.X.Min : nullptr, linkx ? &lims.X.Max : nullptr);
ImPlot::SetupAxisLinks(ImAxis_Y1, linky ? &lims.Y.Min : nullptr, linky ? &lims.Y.Max : nullptr);
ImPlot::PlotLine("Line",data,2);
ImPlot::EndPlot();
}Links an axis range limits to external values. Use BoxedValue to transmit values (which will be updated after EndPlot).
ImPlot::SetupAxisFormat¶
IMPLOT_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::SetupAxesLimits(2.5,5,0,1000);
ImPlot::SetupAxis(ImAxis_Y2, nullptr, ImPlotAxisFlags_AuxDefault);
ImPlot::SetupAxis(ImAxis_Y3, nullptr, ImPlotAxisFlags_AuxDefault);
if (custom_fmt) {
ImPlot::SetupAxisFormat(ImAxis_X1, "%g ms");
ImPlot::SetupAxisFormat(ImAxis_Y1, MetricFormatter, (void*)"Hz");
ImPlot::SetupAxisFormat(ImAxis_Y2, "%g dB");
ImPlot::SetupAxisFormat(ImAxis_Y3, MetricFormatter, (void*)"m");
}Sets the format of numeric axis labels via formatter specifier (default=“%g”). Formatted values will be double (i.e. use %f).
ImPlot::SetupAxisScale¶
IMPLOT_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::BeginPlot("Log Plot", ImVec2(-1,0))) {
ImPlot::SetupAxisScale(ImAxis_X1, ImPlotScale_Log10);
ImPlot::SetupAxesLimits(0.1, 100, 0, 10);
ImPlot::PlotLine("f(x) = x", xs, xs, 1001);
ImPlot::PlotLine("f(x) = sin(x)+1", xs, ys1, 1001);
ImPlot::PlotLine("f(x) = log(x)", xs, ys2, 1001);
ImPlot::PlotLine("f(x) = 10^x", xs, ys3, 21);
ImPlot::EndPlot();
}Sets an axis’ scale using built-in options.
ImPlot::SetupAxisLimitsConstraints¶
IMPLOT_API void SetupAxisLimitsConstraints(ImAxis axis, double v_min, double v_max);See it live: Axes › Custom Scale (also used in 2 other sections)

Code from the demo
if (ImPlot::BeginPlot("Sqrt")) {
ImPlot::SetupAxis(ImAxis_X1, "Linear");
ImPlot::SetupAxis(ImAxis_Y1, "Sqrt");
ImPlot::SetupAxisScale(ImAxis_Y1, TransformForward_Sqrt, TransformInverse_Sqrt);
ImPlot::SetupAxisLimitsConstraints(ImAxis_Y1, 0, INFINITY);
ImPlot::PlotLine("##data",v,v,100);
ImPlot::EndPlot();
}Sets an axis’ limits constraints.
ImPlot::SetupAxisZoomConstraints¶
IMPLOT_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
ImGui::DragFloat2("Limits Constraints", &constraints[0], 0.01f);
ImGui::DragFloat2("Zoom Constraints", &constraints[2], 0.01f);
CHECKBOX_FLAG(flags, ImPlotAxisFlags_PanStretch);
if (ImPlot::BeginPlot("##AxisConstraints",ImVec2(-1,0))) {
ImPlot::SetupAxes("X","Y",flags,flags);
ImPlot::SetupAxesLimits(-1,1,-1,1);
ImPlot::SetupAxisLimitsConstraints(ImAxis_X1,constraints[0], constraints[1]);
ImPlot::SetupAxisZoomConstraints(ImAxis_X1,constraints[2], constraints[3]);
ImPlot::SetupAxisLimitsConstraints(ImAxis_Y1,constraints[0], constraints[1]);
ImPlot::SetupAxisZoomConstraints(ImAxis_Y1,constraints[2], constraints[3]);
ImPlot::EndPlot();
}Sets an axis’ zoom constraints.
ImPlot::SetupAxes¶
IMPLOT_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::BeginPlot("Line Plots")) {
ImPlot::SetupAxes("x","y");
ImPlot::PlotLine("f(x)", xs1, ys1, 1001);
ImPlot::PlotLine("g(x)", xs2, ys2, 20,{
ImPlotProp_Marker, ImPlotMarker_Circle,
ImPlotProp_Flags, ImPlotLineFlags_Segments
});
ImPlot::EndPlot();
}Sets the label and/or flags for primary X and Y axes (shorthand for two calls to SetupAxis).
ImPlot::SetupAxesLimits¶
IMPLOT_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::BeginPlot("Stock Prices")) {
ImPlot::SetupAxes("Days","Price");
ImPlot::SetupAxesLimits(0,100,0,500);
if (show_fills) {
ImPlotSpec spec;
spec.Flags = flags;
spec.FillAlpha = 0.25f;
ImPlot::PlotShaded("Stock 1", xs1, ys1, 101, shade_mode == 0 ? -INFINITY : shade_mode == 1 ? INFINITY : fill_ref, spec);
ImPlot::PlotShaded("Stock 2", xs1, ys2, 101, shade_mode == 0 ? -INFINITY : shade_mode == 1 ? INFINITY : fill_ref, spec);
ImPlot::PlotShaded("Stock 3", xs1, ys3, 101, shade_mode == 0 ? -INFINITY : shade_mode == 1 ? INFINITY : fill_ref, spec);
}
if (show_lines) {
ImPlot::PlotLine("Stock 1", xs1, ys1, 101);
ImPlot::PlotLine("Stock 2", xs1, ys2, 101);
...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).
ImPlot::SetupLegend¶
IMPLOT_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::BeginPlot("##Legend",ImVec2(-1,0))) {
ImPlot::SetupLegend(loc, flags);
static MyImPlot::WaveData data1(0.001, 0.2, 4, 0.2);
static MyImPlot::WaveData data2(0.001, 0.2, 4, 0.4);
static MyImPlot::WaveData data3(0.001, 0.2, 4, 0.6);
static MyImPlot::WaveData data4(0.001, 0.2, 4, 0.8);
static MyImPlot::WaveData data5(0.001, 0.2, 4, 1.0);
ImPlot::PlotLineG("Item 002", MyImPlot::SawWave, &data1, 1000); // "Item B" added to legend
ImPlot::PlotLineG("Item 001##IDText", MyImPlot::SawWave, &data2, 1000); // "Item A" added to legend, text after ## used for ID only
ImPlot::PlotLineG("##NotListed", MyImPlot::SawWave, &data3, 1000); // plotted, but not added to legend
ImPlot::PlotLineG("Item 003", MyImPlot::SawWave, &data4, 1000); // "Item C" added to legend
ImPlot::PlotLineG("Item 003", MyImPlot::SawWave, &data5, 1000); // combined with previous "Item C"
...Sets up the plot legend. This can also be called immediately after BeginSubplots when using ImPlotSubplotFlags_ShareItems.
ImPlot::SetupMouseText¶
IMPLOT_API void SetupMouseText(ImPlotLocation location, ImPlotMouseTextFlags flags=0);Set the location of the current plot’s mouse position text (default = South|East).
ImPlot::SetupFinish¶
IMPLOT_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¶
ImPlot::SetNextAxisLimits¶
IMPLOT_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.
ImPlot::SetNextAxisLinks¶
IMPLOT_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).
ImPlot::SetNextAxisToFit¶
IMPLOT_API void SetNextAxisToFit(ImAxis axis);Set an upcoming axis to auto fit to its data.
ImPlot::SetNextAxesLimits¶
IMPLOT_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).
ImPlot::SetNextAxesToFit¶
IMPLOT_API void SetNextAxesToFit();Sets all upcoming axes to auto fit to their data.
Plot Items¶
ImPlot::PlotLine¶
IMPLOT_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::BeginPlot("Line Plots")) {
ImPlot::SetupAxes("x","y");
ImPlot::PlotLine("f(x)", xs1, ys1, 1001);
ImPlot::PlotLine("g(x)", xs2, ys2, 20,{
ImPlotProp_Marker, ImPlotMarker_Circle,
ImPlotProp_Flags, ImPlotLineFlags_Segments
});
ImPlot::EndPlot();
}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.
ImPlot::PlotScatter¶
IMPLOT_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::BeginPlot("Scatter Plot")) {
ImPlot::PlotScatter("Data 1", xs1, ys1, 100);
ImPlot::PlotScatter("Data 2", xs2, ys2, 50, {
ImPlotProp_Marker, ImPlotMarker_Square,
ImPlotProp_MarkerSize, 6,
ImPlotProp_LineColor, GetColormapColor(1),
ImPlotProp_FillColor, GetColormapColor(1),
ImPlotProp_FillAlpha, 0.25f
});
ImPlot::EndPlot();
}Plots a standard 2D scatter plot. Default marker is ImPlotMarker_Circle.
ImPlot::PlotBubbles¶
IMPLOT_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::BeginPlot("Bubble Plot", ImVec2(-1,0), ImPlotFlags_Equal)) {
ImPlot::PlotBubbles("Data 1", xs, ys1, szs1, 20, {ImPlotProp_FillAlpha, 0.5f});
ImPlot::PlotBubbles("Data 2", xs, ys2, szs2, 20, {ImPlotProp_FillAlpha, 0.5f, ImPlotProp_LineColor, ImVec4(0,0,0,0.0)});
ImPlot::EndPlot();
}Plots a bubble graph. #szs are the radius of each bubble in plot units.
ImPlot::PlotPolygon¶
IMPLOT_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::BeginPlot("Polygon Plot", ImVec2(-1,0), ImPlotFlags_Equal)) {
ImPlot::PlotPolygon("Triangle", tri_xs, tri_ys, 3, {
ImPlotProp_FillAlpha, 0.5f,
});
ImPlot::PlotPolygon("Pentagon", pent_xs, pent_ys, 5, {
ImPlotProp_FillAlpha, 0.5f,
ImPlotProp_FillColor, ImVec4(0,1,0,1),
});
ImPlot::PlotPolygon("Star (Concave)", star_xs, star_ys, 10, {
ImPlotProp_FillAlpha, 0.5f,
ImPlotProp_FillColor, ImVec4(1,1,0,1),
ImPlotProp_Flags, ImPlotPolygonFlags_Concave,
});
...Plots a polygon. Points are specified in counter-clockwise order. If concave, make sure to set the Concave flag.
ImPlot::PlotStairs¶
IMPLOT_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.Flags = flags;
spec.FillAlpha = 0.25f;
spec.Marker = ImPlotMarker_Auto;
ImPlot::PlotStairs("Post Step (default)", ys1, 21, 0.05f, 0, 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]
ImPlot::PlotShaded¶
IMPLOT_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::BeginPlot("Shaded Plots")) {
ImPlot::SetupLegend(ImPlotLocation_NorthWest, ImPlotLegendFlags_Reverse); // reverse legend to match vertical order on plot
ImPlot::PlotShaded("Uncertain Data",xs,ys1,ys2,1001, spec);
ImPlot::PlotLine("Uncertain Data", xs, ys, 1001, spec);
ImPlot::PlotShaded("Overlapping",xs,ys3,ys4,1001, spec);
ImPlot::PlotLine("Overlapping",xs,ys3,1001, spec);
ImPlot::PlotLine("Overlapping",xs,ys4,1001, spec);
ImPlot::EndPlot();
}Plots a shaded (filled) region between two lines, or a line and a horizontal reference. Set yref to +/-INFINITY for infinite fill extents.
ImPlot::PlotBars¶
IMPLOT_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
static ImS8 data[10] = {1,2,3,4,5,6,7,8,9,10};
if (ImPlot::BeginPlot("Bar Plot")) {
ImPlot::PlotBars("Vertical",data,10,0.7,1);
ImPlot::PlotBars("Horizontal",data,10,0.4,1,{ImPlotProp_Flags, ImPlotBarsFlags_Horizontal});
ImPlot::EndPlot();
}Plots a bar graph. Vertical by default. #bar_size and #shift are in plot units.
ImPlot::PlotBarGroups¶
IMPLOT_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::SetupLegend(ImPlotLocation_East, ImPlotLegendFlags_Outside);
if (horz) {
ImPlot::SetupAxes("Score","Student",ImPlotAxisFlags_AutoFit,ImPlotAxisFlags_AutoFit);
ImPlot::SetupAxisTicks(ImAxis_Y1,positions, groups, glabels);
ImPlot::PlotBarGroups(ilabels,data,items,groups,size,0,{ImPlotProp_Flags, flags|ImPlotBarGroupsFlags_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
ImPlot::PlotErrorBars¶
IMPLOT_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::BeginPlot("##ErrorBars")) {
ImPlot::SetupAxesLimits(0, 6, 0, 10);
ImPlot::PlotBars("Bar", xs, bar, 5, 0.5f);
ImPlot::PlotErrorBars("Bar", xs, bar, err1, 5);
ImPlot::PlotErrorBars("Line", xs, lin1, err1, err2, 5, {ImPlotProp_LineColor, GetColormapColor(1), ImPlotProp_Size, 0});
ImPlot::PlotLine("Line", xs, lin1, 5, {ImPlotProp_Marker, ImPlotMarker_Square});
ImPlotSpec spec;
spec.LineColor = GetColormapColor(2);
spec.Size = 6;
spec.LineWeight = 1.5f;
ImPlot::PlotErrorBars("Scatter", xs, lin2, err2, 5, spec);
...Plots vertical error bar. The label_id should be the same as the label_id of the associated line or bar plot.
ImPlot::PlotStems¶
IMPLOT_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::BeginPlot("Stem Plots")) {
ImPlot::SetupAxisLimits(ImAxis_X1,0,1.0);
ImPlot::SetupAxisLimits(ImAxis_Y1,0,1.6);
ImPlot::PlotStems("Stems 1",xs,ys1,51);
ImPlot::PlotStems("Stems 2", xs, ys2,51, 0, {ImPlotProp_Marker, ImPlotMarker_Circle});
ImPlot::EndPlot();
}Plots stems. Vertical by default.
ImPlot::PlotInfLines¶
IMPLOT_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
static double vals[] = {0.25, 0.5, 0.75};
if (ImPlot::BeginPlot("##Infinite")) {
ImPlot::SetupAxes(nullptr,nullptr,ImPlotAxisFlags_NoInitialFit,ImPlotAxisFlags_NoInitialFit);
ImPlot::PlotInfLines("Vertical",vals,3);
ImPlot::PlotInfLines("Horizontal",vals,3,{ImPlotProp_Flags, ImPlotInfLinesFlags_Horizontal});
ImPlot::EndPlot();
}Plots infinite vertical or horizontal lines (e.g. for references or asymptotes).
ImPlot::PlotPieChart¶
IMPLOT_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::BeginPlot("##Pie1", ImVec2(ImGui::GetTextLineHeight()*16,ImGui::GetTextLineHeight()*16), ImPlotFlags_Equal | ImPlotFlags_NoMouseText)) {
ImPlot::SetupAxes(nullptr, nullptr, ImPlotAxisFlags_NoDecorations, ImPlotAxisFlags_NoDecorations);
ImPlot::SetupAxesLimits(0, 1, 0, 1);
ImPlot::PlotPieChart(labels1, data1, 4, 0.5, 0.5, 0.4, "%.2f", 90, {ImPlotProp_Flags, flags});
ImPlot::EndPlot();
}Plots a pie chart. Center and radius are in plot units. #label_fmt can be set to None for no labels.
ImPlot::PlotHistogram¶
IMPLOT_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::BeginPlot("##Histograms")) {
ImPlot::SetupAxes(nullptr,nullptr,ImPlotAxisFlags_AutoFit,ImPlotAxisFlags_AutoFit);
ImPlot::PlotHistogram("Empirical", dist.Data, 10000, bins, 1.0, range ? ImPlotRange(rmin,rmax) : ImPlotRange(), {
ImPlotProp_FillAlpha, 0.5f,
ImPlotProp_Flags, hist_flags
});
if ((hist_flags & ImPlotHistogramFlags_Density) && !(hist_flags & ImPlotHistogramFlags_NoOutliers)) {
if (hist_flags & ImPlotHistogramFlags_Horizontal)
ImPlot::PlotLine("Theoretical",y,x,100);
else
ImPlot::PlotLine("Theoretical",x,y,100);
}
ImPlot::EndPlot();
}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.
ImPlot::PlotHistogram2D¶
IMPLOT_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
double max_count = 0;
ImPlotAxisFlags flags = ImPlotAxisFlags_AutoFit|ImPlotAxisFlags_Foreground;
ImPlot::PushColormap("Hot");
if (ImPlot::BeginPlot("##Hist2D",ImVec2(ImGui::GetContentRegionAvail().x-100-ImGui::GetStyle().ItemSpacing.x,0))) {
ImPlot::SetupAxes(nullptr, nullptr, flags, flags);
ImPlot::SetupAxesLimits(-6,6,-6,6);
max_count = ImPlot::PlotHistogram2D("Hist2D",dist1.Data,dist2.Data,count,xybins[0],xybins[1],ImPlotRect(-6,6,-6,6), {ImPlotProp_Flags, hist_flags});
ImPlot::EndPlot();
}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.
ImPlot::PlotDigital¶
IMPLOT_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 (showDigital[i] && dataDigital[i].Data.size() > 0) {
snprintf(label, sizeof(label), "digital_%d", i);
ImPlot::PlotDigital(label, &dataDigital[i].Data[0].x, &dataDigital[i].Data[0].y, dataDigital[i].Data.size(), {
ImPlotProp_Offset, dataDigital[i].Offset,
ImPlotProp_Stride, 2 * sizeof(float),
ImPlotProp_Size, (i+1) * 4
});
}Plots digital data. Digital plots do not respond to y drag or zoom, and are always referenced to the bottom of the plot.
ImPlot::PlotImage¶
IMPLOT_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
ImGui::SliderFloat2("UV0", &uv0.x, -2, 2, "%.1f");
ImGui::SliderFloat2("UV1", &uv1.x, -2, 2, "%.1f");
ImGui::ColorEdit4("Tint",&tint.x);
if (ImPlot::BeginPlot("##image")) {
#ifdef IMGUI_HAS_TEXTURES
// We use the font atlas ImTextureRef for this demo, but in your real code when you submit
// an image that you have loaded yourself, you would normally have a ImTextureID which works
// just as well (as ImTextureRef can be constructed from ImTextureID).
ImPlot::PlotImage("my image", ImGui::GetIO().Fonts->TexRef, bmin, bmax, uv0, uv1, tint);
#else
ImPlot::PlotImage("my image", ImGui::GetIO().Fonts->TexID, bmin, bmax, uv0, uv1, tint);
#endif
ImPlot::EndPlot();
}Plots an axis-aligned image. #bounds_min/bounds_max are in plot coordinates (y-up) and #uv0/uv1 are in texture coordinates (y-down).
ImPlot::PlotText¶
IMPLOT_API void PlotText(const char* text, double x, double y, const ImVec2& pix_offset=ImVec2(0,0), const ImPlotSpec& spec=ImPlotSpec());See it live: Plots › Markers and Text

Code from the demo
ImPlot::PlotText("Filled Markers", 2.5f, 5.0f);Plots a centered text label at point x,y with an optional pixel offset. Text color can be changed with ImPlot::PushStyleColor(ImPlotCol_InlayText, ...).
ImPlot::PlotDummy¶
IMPLOT_API void PlotDummy(const char* label_id, const ImPlotSpec& spec=ImPlotSpec());See it live: Tools › Legend Options

Code from the demo
for (int i = 0; i < num_dummy_items; ++i) {
char label[32];
snprintf(label, sizeof(label), "Item %03d", i+4);
ImPlot::PlotDummy(label);
}Plots a dummy item (i.e. adds a legend entry colored by ImPlotCol_Line)
Plot Tools¶
ImPlot::DragPoint¶
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
bool clicked[4] = {false, false, false, false};
bool hovered[4] = {false, false, false, false};
bool held[4] = {false, false, false, false};
if (ImPlot::BeginPlot("##Bezier",ImVec2(-1,0),ImPlotFlags_CanvasOnly)) {
ImPlot::SetupAxes(nullptr,nullptr,ax_flags,ax_flags);
ImPlot::SetupAxesLimits(0,1,0,1);
static ImPlotPoint P[] = {ImPlotPoint(.05f,.05f), ImPlotPoint(0.2,0.4), ImPlotPoint(0.8,0.6), ImPlotPoint(.95f,.95f)};
ImPlot::DragPoint(0,&P[0].x,&P[0].y, ImVec4(0,0.9f,0,1),4,flags, &clicked[0], &hovered[0], &held[0]);
ImPlot::DragPoint(1,&P[1].x,&P[1].y, ImVec4(1,0.5f,1,1),4,flags, &clicked[1], &hovered[1], &held[1]);
ImPlot::DragPoint(2,&P[2].x,&P[2].y, ImVec4(0,0.5f,1,1),4,flags, &clicked[2], &hovered[2], &held[2]);
ImPlot::DragPoint(3,&P[3].x,&P[3].y, ImVec4(0,0.9f,0,1),4,flags, &clicked[3], &hovered[3], &held[3]);
static ImPlotPoint B[100];
...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.
ImPlot::DragLineX¶
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
ImGui::CheckboxFlags("NoCursors", (unsigned int*)&flags, ImPlotDragToolFlags_NoCursors); ImGui::SameLine();
ImGui::CheckboxFlags("NoFit", (unsigned int*)&flags, ImPlotDragToolFlags_NoFit); ImGui::SameLine();
ImGui::CheckboxFlags("NoInput", (unsigned int*)&flags, ImPlotDragToolFlags_NoInputs);
if (ImPlot::BeginPlot("##lines",ImVec2(-1,0))) {
ImPlot::SetupAxesLimits(0,1,0,1);
ImPlot::DragLineX(0,&x1,ImVec4(1,1,1,1),1,flags);
ImPlot::DragLineX(1,&x2,ImVec4(1,1,1,1),1,flags);
ImPlot::DragLineY(2,&y1,ImVec4(1,1,1,1),1,flags);
ImPlot::DragLineY(3,&y2,ImVec4(1,1,1,1),1,flags);
double xs[1000], ys[1000];
for (int i = 0; i < 1000; ++i) {
xs[i] = (x2+x1)/2+fabs(x2-x1)*(i/1000.0f - 0.5f);
ys[i] = (y1+y2)/2+fabs(y2-y1)/2*sin(f*i/10);
}
...Shows a draggable vertical guide line at an x-value. #col defaults to ImGuiCol_Text.
ImPlot::DragLineY¶
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
ImGui::CheckboxFlags("NoCursors", (unsigned int*)&flags, ImPlotDragToolFlags_NoCursors); ImGui::SameLine();
ImGui::CheckboxFlags("NoFit", (unsigned int*)&flags, ImPlotDragToolFlags_NoFit); ImGui::SameLine();
ImGui::CheckboxFlags("NoInput", (unsigned int*)&flags, ImPlotDragToolFlags_NoInputs);
if (ImPlot::BeginPlot("##lines",ImVec2(-1,0))) {
ImPlot::SetupAxesLimits(0,1,0,1);
ImPlot::DragLineX(0,&x1,ImVec4(1,1,1,1),1,flags);
ImPlot::DragLineX(1,&x2,ImVec4(1,1,1,1),1,flags);
ImPlot::DragLineY(2,&y1,ImVec4(1,1,1,1),1,flags);
ImPlot::DragLineY(3,&y2,ImVec4(1,1,1,1),1,flags);
double xs[1000], ys[1000];
for (int i = 0; i < 1000; ++i) {
xs[i] = (x2+x1)/2+fabs(x2-x1)*(i/1000.0f - 0.5f);
ys[i] = (y1+y2)/2+fabs(y2-y1)/2*sin(f*i/10);
}
...Shows a draggable horizontal guide line at a y-value. #col defaults to ImGuiCol_Text.
ImPlot::DragRect¶
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
if (ImPlot::BeginPlot("##Main",ImVec2(-1,ImGui::GetTextLineHeight()*10))) {
ImPlot::SetupAxes(nullptr,nullptr,ImPlotAxisFlags_NoTickLabels,ImPlotAxisFlags_NoTickLabels);
ImPlot::SetupAxesLimits(0,0.01,-1,1);
ImPlot::PlotLine("Signal 1", x_data, y_data1, 512);
ImPlot::PlotLine("Signal 2", x_data, y_data2, 512);
ImPlot::PlotLine("Signal 3", x_data, y_data3, 512);
ImPlot::DragRect(0,&rect.X.Min,&rect.Y.Min,&rect.X.Max,&rect.Y.Max,ImVec4(1,0,1,1),flags, &clicked, &hovered, &held);
ImPlot::EndPlot();
}Shows a draggable and resizeable rectangle.
ImPlot::Annotation¶
IMPLOT_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
static bool clamp = false;
ImGui::Checkbox("Clamp",&clamp);
if (ImPlot::BeginPlot("##Annotations")) {
ImPlot::SetupAxesLimits(0,2,0,1);
static float p[] = {0.25f, 0.25f, 0.75f, 0.75f, 0.25f};
ImPlot::PlotScatter("##Points",&p[0],&p[1],4);
ImVec4 col = GetLastItemColor();
ImPlot::Annotation(0.25,0.25,col,ImVec2(-15,15),clamp,"BL");
ImPlot::Annotation(0.75,0.25,col,ImVec2(15,15),clamp,"BR");
ImPlot::Annotation(0.75,0.75,col,ImVec2(15,-15),clamp,"TR");
ImPlot::Annotation(0.25,0.75,col,ImVec2(-15,-15),clamp,"TL");
ImPlot::Annotation(0.5,0.5,col,ImVec2(0,0),clamp,"Center");
ImPlot::Annotation(1.25,0.75,ImVec4(0,1,0,1),ImVec2(0,0),clamp);
...Shows an annotation callout at a chosen point. Clamping keeps annotations in the plot area. Annotations are always rendered on top.
ImPlot::TagX¶
IMPLOT_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
ImPlot::SetupAxis(ImAxis_X2);
ImPlot::SetupAxis(ImAxis_Y2);
if (show) {
ImPlot::TagX(0.25, ImVec4(1,1,0,1));
ImPlot::TagY(0.75, ImVec4(1,1,0,1));
static double drag_tag = 0.25;
ImPlot::DragLineY(0,&drag_tag,ImVec4(1,0,0,1),1,ImPlotDragToolFlags_NoFit);
ImPlot::TagY(drag_tag, ImVec4(1,0,0,1), "Drag");
SetAxes(ImAxis_X2, ImAxis_Y2);
ImPlot::TagX(0.5, ImVec4(0,1,1,1), "%s", "MyTag");
ImPlot::TagY(0.5, ImVec4(0,1,1,1), "Tag: %d", 42);
}Shows a x-axis tag at the specified coordinate value.
ImPlot::TagY¶
IMPLOT_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
ImPlot::SetupAxis(ImAxis_X2);
ImPlot::SetupAxis(ImAxis_Y2);
if (show) {
ImPlot::TagX(0.25, ImVec4(1,1,0,1));
ImPlot::TagY(0.75, ImVec4(1,1,0,1));
static double drag_tag = 0.25;
ImPlot::DragLineY(0,&drag_tag,ImVec4(1,0,0,1),1,ImPlotDragToolFlags_NoFit);
ImPlot::TagY(drag_tag, ImVec4(1,0,0,1), "Drag");
SetAxes(ImAxis_X2, ImAxis_Y2);
ImPlot::TagX(0.5, ImVec4(0,1,1,1), "%s", "MyTag");
ImPlot::TagY(0.5, ImVec4(0,1,1,1), "Tag: %d", 42);
}Shows a y-axis tag at the specified coordinate value.
Plot Utils¶
ImPlot::SetAxis¶
IMPLOT_API void SetAxis(ImAxis axis);See it live: Tools › Drag and Drop

Code from the demo
if (dnd[k].Plt == 1 && dnd[k].Data.size() > 0) {
ImPlot::SetAxis(dnd[k].Yax);
ImPlotSpec spec;
spec.Offset = 0;
spec.Stride = 2 * sizeof(float);
spec.LineColor = dnd[k].Color;
ImPlot::PlotLine(dnd[k].Label, &dnd[k].Data[0].x, &dnd[k].Data[0].y, dnd[k].Data.size(), spec);
// allow legend item labels to be DND sources
if (ImPlot::BeginDragDropSourceItem(dnd[k].Label)) {
ImGui::SetDragDropPayload("MY_DND", &k, sizeof(int));
ImPlot::ItemIcon(dnd[k].Color); ImGui::SameLine();
ImGui::TextUnformatted(dnd[k].Label);
ImPlot::EndDragDropSource();
}
...Select which axis/axes will be used for subsequent plot elements.
ImPlot::SetAxes¶
IMPLOT_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
ImPlot::PlotLine("f(x) = x", xs, xs, 1001);
if (x2_axis) {
ImPlot::SetAxes(ImAxis_X2, ImAxis_Y1);
ImPlot::PlotLine("f(x) = sin(x)*3+1", xs2, ys1, 1001);
}ImPlot::PixelsToPlot¶
IMPLOT_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.
ImPlot::PlotToPixels¶
IMPLOT_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::BeginPlot("##CustomRend")) {
ImVec2 cntr = ImPlot::PlotToPixels(ImPlotPoint(0.5f, 0.5f));
ImVec2 rmin = ImPlot::PlotToPixels(ImPlotPoint(0.25f, 0.75f));
ImVec2 rmax = ImPlot::PlotToPixels(ImPlotPoint(0.75f, 0.25f));
ImPlot::PushPlotClipRect();
ImPlot::GetPlotDrawList()->AddCircleFilled(cntr,20,IM_COL32(255,255,0,255),20);
ImPlot::GetPlotDrawList()->AddRect(rmin, rmax, IM_COL32(128,0,255,255));
ImPlot::PopPlotClipRect();
ImPlot::EndPlot();
}Convert a position in the current plot’s coordinate system to pixels. Passing IMPLOT_AUTO uses the current axes.
ImPlot::GetPlotPos¶
IMPLOT_API ImVec2 GetPlotPos();Get the current Plot position (top-left) in pixels.
ImPlot::GetPlotSize¶
IMPLOT_API ImVec2 GetPlotSize();Get the current Plot size in pixels.
ImPlot::GetPlotMousePos¶
IMPLOT_API ImPlotPoint GetPlotMousePos(ImAxis x_axis = IMPLOT_AUTO, ImAxis y_axis = IMPLOT_AUTO);See it live: Tools › Querying

Code from the demo
ImPlot::SetupAxesLimits(0,1,0,1);
if (ImPlot::IsPlotHovered() && ImGui::IsMouseClicked(0) && ImGui::GetIO().KeyCtrl) {
ImPlotPoint pt = ImPlot::GetPlotMousePos();
data.push_back(pt);
}Returns the mouse position in x,y coordinates of the current plot. Passing IMPLOT_AUTO uses the current axes.
ImPlot::GetPlotLimits¶
IMPLOT_API ImPlotRect GetPlotLimits(ImAxis x_axis = IMPLOT_AUTO, ImAxis y_axis = IMPLOT_AUTO);See it live: Tools › Querying (also used in 1 other section)

Code from the demo
limits = ImPlot::GetPlotLimits();Returns the current plot axis range.
ImPlot::IsPlotHovered¶
IMPLOT_API bool IsPlotHovered();See it live: Tools › Querying

Code from the demo
if (ImPlot::BeginPlot("##Centroid")) {
ImPlot::SetupAxesLimits(0,1,0,1);
if (ImPlot::IsPlotHovered() && ImGui::IsMouseClicked(0) && ImGui::GetIO().KeyCtrl) {
ImPlotPoint pt = ImPlot::GetPlotMousePos();
data.push_back(pt);
}
ImPlotSpec spec;
spec.Offset = 0;
spec.Stride = 2 * sizeof(double);
ImPlotSpec cent_spec;
cent_spec.Marker = ImPlotMarker_Square;
cent_spec.MarkerSize = 6;
ImPlot::PlotScatter("Points", &data[0].x, &data[0].y, data.size(), spec);
if (ImPlot::IsPlotSelected()) {
...Returns True if the plot area in the current plot is hovered.
ImPlot::IsAxisHovered¶
IMPLOT_API bool IsAxisHovered(ImAxis axis);Returns True if the axis label area in the current plot is hovered.
ImPlot::IsSubplotsHovered¶
IMPLOT_API bool IsSubplotsHovered();Returns True if the bounding frame of a subplot is hovered.
ImPlot::IsPlotSelected¶
IMPLOT_API bool IsPlotSelected();See it live: Tools › Querying

Code from the demo
cent_spec.Marker = ImPlotMarker_Square;
cent_spec.MarkerSize = 6;
ImPlot::PlotScatter("Points", &data[0].x, &data[0].y, data.size(), spec);
if (ImPlot::IsPlotSelected()) {
select = ImPlot::GetPlotSelection();
int cnt;
ImPlotPoint centroid = FindCentroid(data,select,cnt);
if (cnt > 0) {
ImPlot::PlotScatter("Centroid", ¢roid.x, ¢roid.y, 1, cent_spec);
}
if (ImGui::IsMouseClicked(ImPlot::GetInputMap().SelectCancel)) {
CancelPlotSelection();
rects.push_back(select);
}
...Returns True if the current plot is being box selected.
ImPlot::GetPlotSelection¶
IMPLOT_API ImPlotRect GetPlotSelection(ImAxis x_axis = IMPLOT_AUTO, ImAxis y_axis = IMPLOT_AUTO);See it live: Tools › Querying

Code from the demo
cent_spec.Marker = ImPlotMarker_Square;
cent_spec.MarkerSize = 6;
ImPlot::PlotScatter("Points", &data[0].x, &data[0].y, data.size(), spec);
if (ImPlot::IsPlotSelected()) {
select = ImPlot::GetPlotSelection();
int cnt;
ImPlotPoint centroid = FindCentroid(data,select,cnt);
if (cnt > 0) {
ImPlot::PlotScatter("Centroid", ¢roid.x, ¢roid.y, 1, cent_spec);
}
if (ImGui::IsMouseClicked(ImPlot::GetInputMap().SelectCancel)) {
CancelPlotSelection();
rects.push_back(select);
}
...Returns the current plot box selection bounds. Passing IMPLOT_AUTO uses the current axes.
ImPlot::CancelPlotSelection¶
IMPLOT_API void CancelPlotSelection();See it live: Tools › Querying

Code from the demo
if (ImGui::IsMouseClicked(ImPlot::GetInputMap().SelectCancel)) {
CancelPlotSelection();
rects.push_back(select);
}Cancels a the current plot box selection.
ImPlot::HideNextItem¶
IMPLOT_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.
ImPlot::BeginAlignedPlots¶
IMPLOT_API bool BeginAlignedPlots(const char* group_id, bool vertical = true);See it live: Axes › Linked Axes

Code from the demo
if (BeginAlignedPlots("AlignedGroup")) {
if (ImPlot::BeginPlot("Plot A")) {
ImPlot::SetupAxisLinks(ImAxis_X1, linkx ? &lims.X.Min : nullptr, linkx ? &lims.X.Max : nullptr);
ImPlot::SetupAxisLinks(ImAxis_Y1, linky ? &lims.Y.Min : nullptr, linky ? &lims.Y.Max : nullptr);
ImPlot::PlotLine("Line",data,2);
ImPlot::EndPlot();
}
if (ImPlot::BeginPlot("Plot B")) {
ImPlot::SetupAxisLinks(ImAxis_X1, linkx ? &lims.X.Min : nullptr, linkx ? &lims.X.Max : nullptr);
ImPlot::SetupAxisLinks(ImAxis_Y1, linky ? &lims.Y.Min : nullptr, linky ? &lims.Y.Max : nullptr);
ImPlot::PlotLine("Line",data,2);
ImPlot::EndPlot();
}
ImPlot::EndAlignedPlots();
...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.
ImPlot::EndAlignedPlots¶
IMPLOT_API void EndAlignedPlots();Only call EndAlignedPlots() if BeginAlignedPlots() returns True!
Legend Utils¶
ImPlot::BeginLegendPopup¶
IMPLOT_API bool BeginLegendPopup(const char* label_id, ImGuiMouseButton mouse_button=1);See it live: Tools › Legend Popups

Code from the demo
if (ImPlot::BeginLegendPopup("Right Click Me")) {
ImGui::SliderFloat("Frequency",&frequency,0,1,"%0.2f");
ImGui::SliderFloat("Amplitude",&litude,0,1,"%0.2f");
ImGui::Separator();
ImGui::ColorEdit3("Color",&color.x);
ImGui::SliderFloat("Transparency",&alpha,0,1,"%.2f");
ImGui::Checkbox("Line Plot", &line);
if (line) {
ImGui::SliderFloat("Thickness", &thickness, 0, 5);
ImGui::Checkbox("Markers", &markers);
ImGui::Checkbox("Shaded",&shaded);
}
ImPlot::EndLegendPopup();
}Begin a popup for a legend entry.
ImPlot::EndLegendPopup¶
IMPLOT_API void EndLegendPopup();End a popup for a legend entry.
ImPlot::IsLegendEntryHovered¶
IMPLOT_API bool IsLegendEntryHovered(const char* label_id);Returns True if a plot item legend entry is hovered.
Drag and Drop¶
ImPlot::BeginDragDropTargetPlot¶
IMPLOT_API bool BeginDragDropTargetPlot();See it live: Tools › Drag and Drop (also used in 1 other section)

Code from the demo
if (ImPlot::BeginDragDropTargetPlot()) {
if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("MY_DND")) {
int i = *(int*)payload->Data; dnd[i].Plt = 1; dnd[i].Yax = ImAxis_Y1;
}
ImPlot::EndDragDropTarget();
}Turns the current plot’s plotting area into a drag and drop target. Don’t forget to call EndDragDropTarget!
ImPlot::BeginDragDropTargetAxis¶
IMPLOT_API bool BeginDragDropTargetAxis(ImAxis axis);See it live: Tools › Drag and Drop

Code from the demo
for (int y = ImAxis_Y1; y <= ImAxis_Y3; ++y) {
if (ImPlot::BeginDragDropTargetAxis(y)) {
if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("MY_DND")) {
int i = *(int*)payload->Data; dnd[i].Plt = 1; dnd[i].Yax = y;
}
ImPlot::EndDragDropTarget();
}
}Turns the current plot’s X-axis into a drag and drop target. Don’t forget to call EndDragDropTarget!
ImPlot::BeginDragDropTargetLegend¶
IMPLOT_API bool BeginDragDropTargetLegend();See it live: Tools › Drag and Drop

Code from the demo
if (ImPlot::BeginDragDropTargetLegend()) {
if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("MY_DND")) {
int i = *(int*)payload->Data; dnd[i].Plt = 1; dnd[i].Yax = ImAxis_Y1;
}
ImPlot::EndDragDropTarget();
}Turns the current plot’s legend into a drag and drop target. Don’t forget to call EndDragDropTarget!
ImPlot::EndDragDropTarget¶
IMPLOT_API void EndDragDropTarget();See it live: Tools › Drag and Drop (also used in 1 other section)

Code from the demo
ImGui::EndChild();
if (ImGui::BeginDragDropTarget()) {
if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("MY_DND")) {
int i = *(int*)payload->Data; dnd[i].Reset();
}
ImGui::EndDragDropTarget();
}Ends a drag and drop target (currently just an alias for ImGui::EndDragDropTarget).
ImPlot::BeginDragDropSourcePlot¶
IMPLOT_API bool BeginDragDropSourcePlot(ImGuiDragDropFlags flags=0);See it live: Tools › Drag and Drop

Code from the demo
if (ImPlot::BeginDragDropSourcePlot()) {
ImGui::TextUnformatted("Yes, you can\ndrag this!");
ImPlot::EndDragDropSource();
}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.
ImPlot::BeginDragDropSourceAxis¶
IMPLOT_API bool BeginDragDropSourceAxis(ImAxis axis, ImGuiDragDropFlags flags=0);See it live: Tools › Drag and Drop

Code from the demo
if (dndx != nullptr && ImPlot::BeginDragDropSourceAxis(ImAxis_X1)) {
ImGui::SetDragDropPayload("MY_DND", &dndx->Idx, sizeof(int));
ImPlot::ItemIcon(dndx->Color); ImGui::SameLine();
ImGui::TextUnformatted(dndx->Label);
ImPlot::EndDragDropSource();
}Turns the current plot’s X-axis into a drag and drop source. You must hold Ctrl. Don’t forget to call EndDragDropSource!
ImPlot::BeginDragDropSourceItem¶
IMPLOT_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 (ImPlot::BeginDragDropSourceItem(dnd[k].Label)) {
ImGui::SetDragDropPayload("MY_DND", &k, sizeof(int));
ImPlot::ItemIcon(dnd[k].Color); ImGui::SameLine();
ImGui::TextUnformatted(dnd[k].Label);
ImPlot::EndDragDropSource();
}Turns an item in the current plot’s legend into drag and drop source. Don’t forget to call EndDragDropSource!
ImPlot::EndDragDropSource¶
IMPLOT_API void EndDragDropSource();See it live: Tools › Drag and Drop (also used in 1 other section)

Code from the demo
ImPlot::ItemIcon(dnd[k].Color); ImGui::SameLine();
ImGui::Selectable(dnd[k].Label, false, 0, ImVec2(100, 0));
if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_None)) {
ImGui::SetDragDropPayload("MY_DND", &k, sizeof(int));
ImPlot::ItemIcon(dnd[k].Color); ImGui::SameLine();
ImGui::TextUnformatted(dnd[k].Label);
ImGui::EndDragDropSource();
}Ends a drag and drop source (currently just an alias for ImGui::EndDragDropSource).
Styling¶
ImPlot::GetStyle¶
IMPLOT_API ImPlotStyle& GetStyle();See it live: Custom › Custom Styles (also used in 7 other sections)

Code from the demo
ImPlotStyle backup = ImPlot::GetStyle();Styling colors in ImPlot works similarly to styling colors in ImGui, but
with one important difference. Like ImGui, all style colors are stored in an
indexable array in ImPlotStyle. You can permanently modify these values through
GetStyle().Colors, or temporarily modify them with Push/Pop functions below.
However, by default all style colors in ImPlot default to a special color
IMPLOT_AUTO_COL. IMPLOT_AUTO_COL tells ImPlot to set that color from color data
in your ImGuiStyle. The ImGuiCol_ that these style colors default to are
detailed above, and in general have been mapped to produce plots visually
consistent with your current ImGui style. Of course, you are free to
manually set these colors to whatever you like, and further can Push/Pop
them around individual plots for plot-specific styling (e.g. coloring axes).
Provides access to plot style structure for permanent modifications to colors, sizes, etc.
ImPlot::SetStyle¶
IMPLOT_API void SetStyle(const ImPlotStyle& style);ImPlot::StyleColorsAuto¶
IMPLOT_API void StyleColorsAuto(ImPlotStyle* dst = nullptr);Style plot colors for current ImGui style (default).
ImPlot::StyleColorsClassic¶
IMPLOT_API void StyleColorsClassic(ImPlotStyle* dst = nullptr);Style plot colors for ImGui “Classic”.
ImPlot::StyleColorsDark¶
IMPLOT_API void StyleColorsDark(ImPlotStyle* dst = nullptr);Style plot colors for ImGui “Dark”.
ImPlot::StyleColorsLight¶
IMPLOT_API void StyleColorsLight(ImPlotStyle* dst = nullptr);Style plot colors for ImGui “Light”.
ImPlot::PushStyleColor¶
IMPLOT_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::PushStyleColor(ImPlotCol_InlayText, ImVec4(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!
ImPlot::PopStyleColor¶
IMPLOT_API void PopStyleColor(int count = 1);See it live: Plots › Markers and Text (also used in 2 other sections)

Code from the demo
ImPlot::PushStyleColor(ImPlotCol_InlayText, ImVec4(1,0,1,1));
ImPlot::PlotText("Vertical Text", 5.0f, 5.0f, ImVec2(0,0), {ImPlotProp_Flags, ImPlotTextFlags_Vertical});
ImPlot::PopStyleColor();Undo temporary style color modification(s). Undo multiple pushes at once by increasing count.
ImPlot::PushStyleVar¶
IMPLOT_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!
ImPlot::PopStyleVar¶
IMPLOT_API void PopStyleVar(int count = 1);Undo temporary style variable modification(s). Undo multiple pushes at once by increasing count.
ImPlot::GetLastItemColor¶
IMPLOT_API ImVec4 GetLastItemColor();See it live: Tools › Annotations (also used in 2 other sections)

Code from the demo
static bool clamp = false;
ImGui::Checkbox("Clamp",&clamp);
if (ImPlot::BeginPlot("##Annotations")) {
ImPlot::SetupAxesLimits(0,2,0,1);
static float p[] = {0.25f, 0.25f, 0.75f, 0.75f, 0.25f};
ImPlot::PlotScatter("##Points",&p[0],&p[1],4);
ImVec4 col = GetLastItemColor();
ImPlot::Annotation(0.25,0.25,col,ImVec2(-15,15),clamp,"BL");
ImPlot::Annotation(0.75,0.25,col,ImVec2(15,15),clamp,"BR");
ImPlot::Annotation(0.75,0.75,col,ImVec2(15,-15),clamp,"TR");
ImPlot::Annotation(0.25,0.75,col,ImVec2(-15,-15),clamp,"TL");
ImPlot::Annotation(0.5,0.5,col,ImVec2(0,0),clamp,"Center");
ImPlot::Annotation(1.25,0.75,ImVec4(0,1,0,1),ImVec2(0,0),clamp);
...Gets the last item primary color (i.e. its legend icon color)
ImPlot::GetStyleColorName¶
IMPLOT_API const char* GetStyleColorName(ImPlotCol idx);Returns the null terminated string name for an ImPlotCol.
ImPlot::GetMarkerName¶
IMPLOT_API const char* GetMarkerName(ImPlotMarker idx);Returns the null terminated string name for an ImPlotMarker.
ImPlot::NextMarker¶
IMPLOT_API ImPlotMarker NextMarker();Returns the next marker and advances the marker for the current plot. You need to call this between Begin/EndPlot!
Colormaps¶
ImPlot::GetColormapCount¶
IMPLOT_API int GetColormapCount();See it live: Plots › Heatmaps (also used in 1 other section)

Code from the demo
static ImPlotColormap map = ImPlotColormap_Viridis;
if (ImPlot::ColormapButton(ImPlot::GetColormapName(map),ImVec2(225,0),map)) {
map = (map + 1) % ImPlot::GetColormapCount();
// We bust the color cache of our plots so that item colors will
// resample the new colormap in the event that they have already
// been created. See documentation in implot.h.
BustColorCache("##Heatmap1");
BustColorCache("##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.
ImPlot::GetColormapName¶
IMPLOT_API const char* GetColormapName(ImPlotColormap cmap);See it live: Plots › Heatmaps

Code from the demo
static ImPlotColormap map = ImPlotColormap_Viridis;
if (ImPlot::ColormapButton(ImPlot::GetColormapName(map),ImVec2(225,0),map)) {
map = (map + 1) % ImPlot::GetColormapCount();
// We bust the color cache of our plots so that item colors will
// resample the new colormap in the event that they have already
// been created. See documentation in implot.h.
BustColorCache("##Heatmap1");
BustColorCache("##Heatmap2");
}Returns a null terminated string name for a colormap given an index. Returns None if index is invalid.
ImPlot::GetColormapIndex¶
IMPLOT_API ImPlotColormap GetColormapIndex(const char* name);Returns an index number for a colormap given a valid string name. Returns -1 if name is invalid.
ImPlot::PushColormap¶
IMPLOT_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::PushColormap(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!
ImPlot::PopColormap¶
IMPLOT_API void PopColormap(int count = 1);See it live: Plots › Bar Stacks (also used in 6 other sections)

Code from the demo
ImPlot::PopColormap();Undo temporary colormap modification(s). Undo multiple pushes at once by increasing count.
ImPlot::NextColormapColor¶
IMPLOT_API ImVec4 NextColormapColor();See it live: Custom › Custom Styles

Code from the demo
unsigned int dot[10] = {7,6,6,7,8,5,6,5,8,7};
ImPlot::PlotBars("Bars", bar, 10, 0.5f);
ImPlot::PlotLine("Line", lin, 10);
ImPlot::NextColormapColor(); // skip green
ImPlot::PlotScatter("Scatter", dot, 10);Returns the next color from the current colormap and advances the colormap for the current plot.
Can also be used with no return value to skip colors if desired. You need to call this between Begin/EndPlot!
ImPlot::GetColormapSize¶
IMPLOT_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.
ImPlot::GetColormapColor¶
IMPLOT_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::BeginPlot("Scatter Plot")) {
ImPlot::PlotScatter("Data 1", xs1, ys1, 100);
ImPlot::PlotScatter("Data 2", xs2, ys2, 50, {
ImPlotProp_Marker, ImPlotMarker_Square,
ImPlotProp_MarkerSize, 6,
ImPlotProp_LineColor, GetColormapColor(1),
ImPlotProp_FillColor, GetColormapColor(1),
ImPlotProp_FillAlpha, 0.25f
});
ImPlot::EndPlot();
}Returns a color from a colormap given an index >= 0 (modulo will be performed).
ImPlot::SampleColormap¶
IMPLOT_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 double xs2[20], ys2[20];
static ImU32 colors2[20];
for (int i = 0; i < 20; ++i) {
xs2[i] = i * 1/19.0f;
ys2[i] = xs2[i] * xs2[i];
// Colormap colors for g(x)
float t = i / 19.0f;
ImVec4 color = ImPlot::SampleColormap(t, ImPlotColormap_Viridis);
colors2[i] = ImGui::GetColorU32(color);
}Sample a color from the current colormap given t between 0 and 1.
ImPlot::ColormapScale¶
IMPLOT_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
static ImPlotColormapScaleFlags flags = 0;
static float scale[2] = {0, 100};
ImPlot::ColormapScale("Scale",scale[0],scale[1],ImVec2(0,0),"%g dB",flags,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.
ImPlot::ColormapSlider¶
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

Code from the demo
static ImVec4 col;
ImGui::ColorButton("##Display",col,ImGuiColorEditFlags_NoInputs);
ImGui::SameLine();
ImPlot::ColormapSlider("Slider", &t, &col, "%.3f", cmap);Shows a horizontal slider with a colormap gradient background. Optionally returns the color sampled at t in [0 1].
ImPlot::ColormapButton¶
IMPLOT_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::ColormapButton("Button",ImVec2(0,0),cmap)) {
cmap = (cmap + 1) % ImPlot::GetColormapCount();
}Shows a button with a colormap gradient background.
ImPlot::BustColorCache¶
IMPLOT_API void BustColorCache(const char* plot_title_id = nullptr);See it live: Plots › Heatmaps

Code from the demo
static ImPlotColormap map = ImPlotColormap_Viridis;
if (ImPlot::ColormapButton(ImPlot::GetColormapName(map),ImVec2(225,0),map)) {
map = (map + 1) % ImPlot::GetColormapCount();
// We bust the color cache of our plots so that item colors will
// resample the new colormap in the event that they have already
// been created. See documentation in implot.h.
BustColorCache("##Heatmap1");
BustColorCache("##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¶
ImPlot::GetInputMap¶
IMPLOT_API ImPlotInputMap& GetInputMap();See it live: Tools › Querying

Code from the demo
cent_spec.Marker = ImPlotMarker_Square;
cent_spec.MarkerSize = 6;
ImPlot::PlotScatter("Points", &data[0].x, &data[0].y, data.size(), spec);
if (ImPlot::IsPlotSelected()) {
select = ImPlot::GetPlotSelection();
int cnt;
ImPlotPoint centroid = FindCentroid(data,select,cnt);
if (cnt > 0) {
ImPlot::PlotScatter("Centroid", ¢roid.x, ¢roid.y, 1, cent_spec);
}
if (ImGui::IsMouseClicked(ImPlot::GetInputMap().SelectCancel)) {
CancelPlotSelection();
rects.push_back(select);
}
...Provides access to input mapping structure for permanent modifications to controls for pan, select, etc.
ImPlot::MapInputDefault¶
IMPLOT_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.
ImPlot::MapInputReverse¶
IMPLOT_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¶
ImPlot::ItemIcon¶
IMPLOT_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
float fj = 0.01f * (j+2);
snprintf(label, sizeof(label), "data%d", j);
ImPlot::PlotLineG(label,SinewaveGetter,&fj,1000);
if (ImPlot::BeginDragDropSourceItem(label)) {
curj = j;
ImGui::SetDragDropPayload("MY_DND",nullptr,0);
ImPlot::ItemIcon(GetLastItemColor()); ImGui::SameLine();
ImGui::TextUnformatted(label);
ImPlot::EndDragDropSource();
}Render icons similar to those that appear in legends (nifty for data lists).
ImPlot::ColormapIcon¶
IMPLOT_API void ColormapIcon(ImPlotColormap cmap);See it live: Tools › Colormap Widgets

Code from the demo
ImPlot::ColormapIcon(cmap); ImGui::SameLine(); ImGui::Text("Icon");ImPlot::GetPlotDrawList¶
IMPLOT_API ImDrawList* GetPlotDrawList();See it live: Custom › Custom Rendering

Code from the demo
if (ImPlot::BeginPlot("##CustomRend")) {
ImVec2 cntr = ImPlot::PlotToPixels(ImPlotPoint(0.5f, 0.5f));
ImVec2 rmin = ImPlot::PlotToPixels(ImPlotPoint(0.25f, 0.75f));
ImVec2 rmax = ImPlot::PlotToPixels(ImPlotPoint(0.75f, 0.25f));
ImPlot::PushPlotClipRect();
ImPlot::GetPlotDrawList()->AddCircleFilled(cntr,20,IM_COL32(255,255,0,255),20);
ImPlot::GetPlotDrawList()->AddRect(rmin, rmax, IM_COL32(128,0,255,255));
ImPlot::PopPlotClipRect();
ImPlot::EndPlot();
}Get the plot draw list for custom rendering to the current plot area. Call between Begin/EndPlot.
ImPlot::PushPlotClipRect¶
IMPLOT_API void PushPlotClipRect(float expand=0);See it live: Custom › Custom Rendering

Code from the demo
if (ImPlot::BeginPlot("##CustomRend")) {
ImVec2 cntr = ImPlot::PlotToPixels(ImPlotPoint(0.5f, 0.5f));
ImVec2 rmin = ImPlot::PlotToPixels(ImPlotPoint(0.25f, 0.75f));
ImVec2 rmax = ImPlot::PlotToPixels(ImPlotPoint(0.75f, 0.25f));
ImPlot::PushPlotClipRect();
ImPlot::GetPlotDrawList()->AddCircleFilled(cntr,20,IM_COL32(255,255,0,255),20);
ImPlot::GetPlotDrawList()->AddRect(rmin, rmax, IM_COL32(128,0,255,255));
ImPlot::PopPlotClipRect();
ImPlot::EndPlot();
}Push clip rect for rendering to current plot area. The rect can be expanded or contracted by #expand pixels. Call between Begin/EndPlot.
ImPlot::PopPlotClipRect¶
IMPLOT_API void PopPlotClipRect();See it live: Custom › Custom Rendering

Code from the demo
if (ImPlot::BeginPlot("##CustomRend")) {
ImVec2 cntr = ImPlot::PlotToPixels(ImPlotPoint(0.5f, 0.5f));
ImVec2 rmin = ImPlot::PlotToPixels(ImPlotPoint(0.25f, 0.75f));
ImVec2 rmax = ImPlot::PlotToPixels(ImPlotPoint(0.75f, 0.25f));
ImPlot::PushPlotClipRect();
ImPlot::GetPlotDrawList()->AddCircleFilled(cntr,20,IM_COL32(255,255,0,255),20);
ImPlot::GetPlotDrawList()->AddRect(rmin, rmax, IM_COL32(128,0,255,255));
ImPlot::PopPlotClipRect();
ImPlot::EndPlot();
}Pop plot clip rect. Call between Begin/EndPlot.
ImPlot::ShowStyleSelector¶
IMPLOT_API bool ShowStyleSelector(const char* label);See it live: Config

Code from the demo
ImGui::ShowFontSelector("Font");
ImGui::ShowStyleSelector("ImGui Style");Shows ImPlot style selector dropdown menu.
ImPlot::ShowColormapSelector¶
IMPLOT_API bool ShowColormapSelector(const char* label);See it live: Config

Code from the demo
ImGui::ShowFontSelector("Font");
ImGui::ShowStyleSelector("ImGui Style");
ImPlot::ShowStyleSelector("ImPlot Style");
ImPlot::ShowColormapSelector("ImPlot Colormap");Shows ImPlot colormap selector dropdown menu.
ImPlot::ShowInputMapSelector¶
IMPLOT_API bool ShowInputMapSelector(const char* label);See it live: Config

Code from the demo
ImGui::ShowStyleSelector("ImGui Style");
ImPlot::ShowStyleSelector("ImPlot Style");
ImPlot::ShowColormapSelector("ImPlot Colormap");
ImPlot::ShowInputMapSelector("Input Map");Shows ImPlot input map selector dropdown menu.
ImPlot::ShowStyleEditor¶
IMPLOT_API void ShowStyleEditor(ImPlotStyle* ref = nullptr);Shows ImPlot style editor block (not a window).
ImPlot::ShowUserGuide¶
IMPLOT_API void ShowUserGuide();See it live: Demo_Help

Code from the demo
ImGui::Unindent();
ImGui::Separator();
ImGui::Text("USER GUIDE:");
ShowUserGuide();Add basic help/info block for end users (not a window).
ImPlot::ShowMetricsWindow¶
IMPLOT_API void ShowMetricsWindow(bool* p_popen = nullptr);Shows ImPlot metrics/debug information window.
Demo¶
ImPlot::ShowDemoWindow¶
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!)
ImPlot::ShowDemoWindow_MaybeDocked¶
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.