Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

implot (C++)

ImPlot: 2D plots for Dear ImGui: lines, scatter, bars, shaded areas, heatmaps, histograms, pie charts, real-time data.

The C++ API of ImPlot as it is bound to Python: the entries of the module imgui_bundle.implot, in the same order, with their C++ signatures and the headers’ comments. From the stubs: the functions excluded from the bindings, the typedefs and the macros are absent.

Start with: ImPlot::BeginPlot, ImPlot::EndPlot, ImPlot::PlotLine, ImPlot::PlotScatter, ImPlot::SetupAxes.

implot.h

BoxedValue (struct)

Member
double value;

Enums and Types

Forward declarations

Enums/Flags

ImAxis_ (enum)

Axis indices. The values assigned may change; NEVER hardcode these.

MemberValue
ImAxis_X1 = 00enabled by default
ImAxis_X21disabled by default
ImAxis_X32disabled by default
ImAxis_Y13enabled by default
ImAxis_Y24disabled by default
ImAxis_Y35disabled by default
ImAxis_COUNT6

Prop_ (enum)

Plotting properties. These provide syntactic sugar for creating ImPlotSpecs from (ImPlotProp,value) pairs. See ImPlotSpec documentation.

MemberValue
ImPlotProp_LineColor0line color (applies to lines, bar edges); IMPLOT_AUTO_COL will use next Colormap color or current item color
ImPlotProp_LineColors1array of colors for each line; if None, use LineColor for all lines
ImPlotProp_LineWeight2line weight in pixels (applies to lines, bar edges, marker edges)
ImPlotProp_FillColor3fill color (applies to shaded regions, bar faces); IMPLOT_AUTO_COL will use next Colormap color or current item color
ImPlotProp_FillColors4array of colors for each fill; if None, use FillColor for all fills
ImPlotProp_FillAlpha5alpha multiplier (applies to FillColor, FillColors, MarkerFillColor, and MarkerFillColors)
ImPlotProp_Marker6marker type; specify ImPlotMarker_Auto to use the next unused marker
ImPlotProp_MarkerSize7size of markers (radius) in pixels
ImPlotProp_MarkerSizes8array of sizes for each marker; if None, use MarkerSize for all markers
ImPlotProp_MarkerLineColor9marker edge color; IMPLOT_AUTO_COL will use LineColor
ImPlotProp_MarkerLineColors10array of colors for each marker edge; if None, use MarkerLineColor for all markers
ImPlotProp_MarkerFillColor11marker face color; IMPLOT_AUTO_COL will use LineColor
ImPlotProp_MarkerFillColors12array of colors for each marker face; if None, use MarkerFillColor for all markers
ImPlotProp_Size13size of error bar whiskers (width or height), and digital bars (height) in pixels
ImPlotProp_Offset14data index offset
ImPlotProp_Stride15data stride in bytes; IMPLOT_AUTO will result in sizeof(T) where T is the type passed to PlotX
ImPlotProp_Flags16optional item flags; can be composed from common ImPlotItemFlags and/or specialized ImPlotXFlags

Flags_ (enum)

Options for plots (see BeginPlot).

MemberValue
ImPlotFlags_None = 00default
ImPlotFlags_NoTitle = 1 << 01 << 0the plot title will not be displayed (titles are also hidden if preceded by double hashes, e.g. “##MyPlot”)
ImPlotFlags_NoLegend = 1 << 11 << 1the legend will not be displayed
ImPlotFlags_NoMouseText = 1 << 21 << 2the mouse position, in plot coordinates, will not be displayed inside of the plot
ImPlotFlags_NoInputs = 1 << 31 << 3the user will not be able to interact with the plot
ImPlotFlags_NoMenus = 1 << 41 << 4the user will not be able to open context menus
ImPlotFlags_NoBoxSelect = 1 << 51 << 5the user will not be able to box-select
ImPlotFlags_NoFrame = 1 << 61 << 6the ImGui frame will not be rendered
ImPlotFlags_Equal = 1 << 71 << 7x and y axes pairs will be constrained to have the same units/pixel
ImPlotFlags_Crosshairs = 1 << 81 << 8the default mouse cursor will be replaced with a crosshair when hovered
ImPlotFlags_CanvasOnly = ImPlotFlags_NoTitle | ImPlotFlags_NoLegend | ImPlotFlags_NoMenus | ImPlotFlags_NoBoxSelect | ImPlotFlags_NoMouseTextFlags_NoTitle | Flags_NoLegend | Flags_NoMenus | Flags_NoBoxSelect | Flags_NoMouseText

AxisFlags_ (enum)

Options for plot axes (see SetupAxis).

MemberValue
ImPlotAxisFlags_None = 00default
ImPlotAxisFlags_NoLabel = 1 << 01 << 0the axis label will not be displayed (axis labels are also hidden if the supplied string name is None)
ImPlotAxisFlags_NoGridLines = 1 << 11 << 1no grid lines will be displayed
ImPlotAxisFlags_NoTickMarks = 1 << 21 << 2no tick marks will be displayed
ImPlotAxisFlags_NoTickLabels = 1 << 31 << 3no text labels will be displayed
ImPlotAxisFlags_NoInitialFit = 1 << 41 << 4axis will not be initially fit to data extents on the first rendered frame
ImPlotAxisFlags_NoMenus = 1 << 51 << 5the user will not be able to open context menus with right-click
ImPlotAxisFlags_NoSideSwitch = 1 << 61 << 6the user will not be able to switch the axis side by dragging it
ImPlotAxisFlags_NoHighlight = 1 << 71 << 7the axis will not have its background highlighted when hovered or held
ImPlotAxisFlags_Opposite = 1 << 81 << 8axis ticks and labels will be rendered on the conventionally opposite side (i.e, right or top)
ImPlotAxisFlags_Foreground = 1 << 91 << 9grid lines will be displayed in the foreground (i.e. on top of data) instead of the background
ImPlotAxisFlags_Invert = 1 << 101 << 10the axis will be inverted
ImPlotAxisFlags_AutoFit = 1 << 111 << 11axis will be auto-fitting to data extents
ImPlotAxisFlags_RangeFit = 1 << 121 << 12axis will only fit points if the point is in the visible range of the orthogonal axis
ImPlotAxisFlags_PanStretch = 1 << 131 << 13panning in a locked or constrained state will cause the axis to stretch if possible
ImPlotAxisFlags_LockMin = 1 << 141 << 14the axis minimum value will be locked when panning/zooming
ImPlotAxisFlags_LockMax = 1 << 151 << 15the axis maximum value will be locked when panning/zooming
ImPlotAxisFlags_Lock = ImPlotAxisFlags_LockMin | ImPlotAxisFlags_LockMaxAxisFlags_LockMin | AxisFlags_LockMax
ImPlotAxisFlags_NoDecorations = ImPlotAxisFlags_NoLabel | ImPlotAxisFlags_NoGridLines | ImPlotAxisFlags_NoTickMarks | ImPlotAxisFlags_NoTickLabelsAxisFlags_NoLabel | AxisFlags_NoGridLines | AxisFlags_NoTickMarks | AxisFlags_NoTickLabels
ImPlotAxisFlags_AuxDefault = ImPlotAxisFlags_NoGridLines | ImPlotAxisFlags_OppositeAxisFlags_NoGridLines | AxisFlags_Opposite

SubplotFlags_ (enum)

Options for subplots (see BeginSubplot)

MemberValue
ImPlotSubplotFlags_None = 00default
ImPlotSubplotFlags_NoTitle = 1 << 01 << 0the subplot title will not be displayed (titles are also hidden if preceded by double hashes, e.g. “##MySubplot”)
ImPlotSubplotFlags_NoLegend = 1 << 11 << 1the legend will not be displayed (only applicable if ImPlotSubplotFlags_ShareItems is enabled)
ImPlotSubplotFlags_NoMenus = 1 << 21 << 2the user will not be able to open context menus with right-click
ImPlotSubplotFlags_NoResize = 1 << 31 << 3resize splitters between subplot cells will be not be provided
ImPlotSubplotFlags_NoAlign = 1 << 41 << 4subplot edges will not be aligned vertically or horizontally
ImPlotSubplotFlags_ShareItems = 1 << 51 << 5items across all subplots will be shared and rendered into a single legend entry
ImPlotSubplotFlags_LinkRows = 1 << 61 << 6link the y-axis limits of all plots in each row (does not apply to auxiliary axes)
ImPlotSubplotFlags_LinkCols = 1 << 71 << 7link the x-axis limits of all plots in each column (does not apply to auxiliary axes)
ImPlotSubplotFlags_LinkAllX = 1 << 81 << 8link the x-axis limits in every plot in the subplot (does not apply to auxiliary axes)
ImPlotSubplotFlags_LinkAllY = 1 << 91 << 9link the y-axis limits in every plot in the subplot (does not apply to auxiliary axes)
ImPlotSubplotFlags_ColMajor = 1 << 101 << 10subplots are added in column major order instead of the default row major order

LegendFlags_ (enum)

Options for legends (see SetupLegend)

MemberValue
ImPlotLegendFlags_None = 00default
ImPlotLegendFlags_NoButtons = 1 << 01 << 0legend icons will not function as hide/show buttons
ImPlotLegendFlags_NoHighlightItem = 1 << 11 << 1plot items will not be highlighted when their legend entry is hovered
ImPlotLegendFlags_NoHighlightAxis = 1 << 21 << 2axes will not be highlighted when legend entries are hovered (only relevant if x/y-axis count > 1)
ImPlotLegendFlags_NoMenus = 1 << 31 << 3the user will not be able to open context menus with right-click
ImPlotLegendFlags_Outside = 1 << 41 << 4legend will be rendered outside of the plot area
ImPlotLegendFlags_Horizontal = 1 << 51 << 5legend entries will be displayed horizontally
ImPlotLegendFlags_Sort = 1 << 61 << 6legend entries will be displayed in alphabetical order
ImPlotLegendFlags_Reverse = 1 << 71 << 7legend entries will be displayed in reverse order

MouseTextFlags_ (enum)

Options for mouse hover text (see SetupMouseText)

MemberValue
ImPlotMouseTextFlags_None = 00default
ImPlotMouseTextFlags_NoAuxAxes = 1 << 01 << 0only show the mouse position for primary axes
ImPlotMouseTextFlags_NoFormat = 1 << 11 << 1axes label formatters won’t be used to render text
ImPlotMouseTextFlags_ShowAlways = 1 << 21 << 2always display mouse position even if plot not hovered

DragToolFlags_ (enum)

Options for DragPoint, DragLine, DragRect

MemberValue
ImPlotDragToolFlags_None = 00default
ImPlotDragToolFlags_NoCursors = 1 << 01 << 0drag tools won’t change cursor icons when hovered or held
ImPlotDragToolFlags_NoFit = 1 << 11 << 1the drag tool won’t be considered for plot fits
ImPlotDragToolFlags_NoInputs = 1 << 21 << 2lock the tool from user inputs
ImPlotDragToolFlags_Delayed = 1 << 31 << 3tool rendering will be delayed one frame; useful when applying position-constraints

ColormapScaleFlags_ (enum)

Flags for ColormapScale

MemberValue
ImPlotColormapScaleFlags_None = 00default
ImPlotColormapScaleFlags_NoLabel = 1 << 01 << 0the colormap axis label will not be displayed
ImPlotColormapScaleFlags_Opposite = 1 << 11 << 1render the colormap label and tick labels on the opposite side
ImPlotColormapScaleFlags_Invert = 1 << 21 << 2invert the colormap bar and axis scale (this only affects rendering; if you only want to reverse the scale mapping, make scale_min > scale_max)

ItemFlags_ (enum)

Flags for ANY PlotX function. Used by setting ImPlotSpec::Flags.

MemberValue
ImPlotItemFlags_None = 00
ImPlotItemFlags_NoLegend = 1 << 01 << 0the item won’t have a legend entry displayed
ImPlotItemFlags_NoFit = 1 << 11 << 1the item won’t be considered for plot fits

LineFlags_ (enum)

Flags for PlotLine. Used by setting ImPlotSpec::Flags.

MemberValue
ImPlotLineFlags_None = 00default
ImPlotLineFlags_Segments = 1 << 101 << 10a line segment will be rendered from every two consecutive points
ImPlotLineFlags_Loop = 1 << 111 << 11the last and first point will be connected to form a closed loop
ImPlotLineFlags_SkipNaN = 1 << 121 << 12NaNs values will be skipped instead of rendered as missing data
ImPlotLineFlags_NoClip = 1 << 131 << 13markers (if displayed) on the edge of a plot will not be clipped
ImPlotLineFlags_Shaded = 1 << 141 << 14a filled region between the line and horizontal origin will be rendered; use PlotShaded for more advanced cases

ScatterFlags_ (enum)

Flags for PlotScatter. Used by setting ImPlotSpec::Flags.

MemberValue
ImPlotScatterFlags_None = 00default
ImPlotScatterFlags_NoClip = 1 << 101 << 10markers on the edge of a plot will not be clipped

BubblesFlags_ (enum)

Flags for PlotBubbles. Used by setting ImPlotSpec::Flags.

MemberValue
ImPlotBubblesFlags_None = 00default

PolygonFlags_ (enum)

Flags for PlotPolygon. Used by setting ImPlotSpec::Flags.

MemberValue
ImPlotPolygonFlags_None = 00default (closed, convex polygon)
ImPlotPolygonFlags_Concave = 1 << 101 << 10use concave polygon filling (slower but supports concave shapes)

StairsFlags_ (enum)

Flags for PlotStairs. Used by setting ImPlotSpec::Flags.

MemberValue
ImPlotStairsFlags_None = 00default
ImPlotStairsFlags_PreStep = 1 << 101 << 10the 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 << 111 << 11a filled region between the stairs and horizontal origin will be rendered; use PlotShaded for more advanced cases

ShadedFlags_ (enum)

Flags for PlotShaded (placeholder). Used by setting ImPlotSpec::Flags.

MemberValue
ImPlotShadedFlags_None = 00default

BarsFlags_ (enum)

Flags for PlotBars. Used by setting ImPlotSpec::Flags.

MemberValue
ImPlotBarsFlags_None = 00default
ImPlotBarsFlags_Horizontal = 1 << 101 << 10bars will be rendered horizontally on the current y-axis

BarGroupsFlags_ (enum)

Flags for PlotBarGroups. Used by setting ImPlotSpec::Flags.

MemberValue
ImPlotBarGroupsFlags_None = 00default
ImPlotBarGroupsFlags_Horizontal = 1 << 101 << 10bar groups will be rendered horizontally on the current y-axis
ImPlotBarGroupsFlags_Stacked = 1 << 111 << 11items in a group will be stacked on top of each other

ErrorBarsFlags_ (enum)

Flags for PlotErrorBars. Used by setting ImPlotSpec::Flags.

MemberValue
ImPlotErrorBarsFlags_None = 00default
ImPlotErrorBarsFlags_Horizontal = 1 << 101 << 10error bars will be rendered horizontally on the current y-axis

StemsFlags_ (enum)

Flags for PlotStems. Used by setting ImPlotSpec::Flags.

MemberValue
ImPlotStemsFlags_None = 00default
ImPlotStemsFlags_Horizontal = 1 << 101 << 10stems will be rendered horizontally on the current y-axis

InfLinesFlags_ (enum)

Flags for PlotInfLines. Used by setting ImPlotSpec::Flags.

MemberValue
ImPlotInfLinesFlags_None = 00default
ImPlotInfLinesFlags_Horizontal = 1 << 101 << 10lines will be rendered horizontally on the current y-axis

PieChartFlags_ (enum)

Flags for PlotPieChart. Used by setting ImPlotSpec::Flags.

MemberValue
ImPlotPieChartFlags_None = 00default
ImPlotPieChartFlags_Normalize = 1 << 101 << 10force normalization of pie chart values (i.e. always make a full circle if sum < 0)
ImPlotPieChartFlags_IgnoreHidden = 1 << 111 << 11ignore hidden slices when drawing the pie chart (as if they were not there)
ImPlotPieChartFlags_Exploding = 1 << 121 << 12explode legend-hovered slice
ImPlotPieChartFlags_NoSliceBorder = 1 << 131 << 13do not draw slice borders

HeatmapFlags_ (enum)

Flags for PlotHeatmap. Used by setting ImPlotSpec::Flags.

MemberValue
ImPlotHeatmapFlags_None = 00default
ImPlotHeatmapFlags_ColMajor = 1 << 101 << 10data will be read in column major order

HistogramFlags_ (enum)

Flags for PlotHistogram and PlotHistogram2D. Used by setting ImPlotSpec::Flags.

MemberValue
ImPlotHistogramFlags_None = 00default
ImPlotHistogramFlags_Horizontal = 1 << 101 << 10histogram bars will be rendered horizontally (not supported by PlotHistogram2D)
ImPlotHistogramFlags_Cumulative = 1 << 111 << 11each bin will contain its count plus the counts of all previous bins (not supported by PlotHistogram2D)
ImPlotHistogramFlags_Density = 1 << 121 << 12counts will be normalized, i.e. the PDF will be visualized, or the CDF will be visualized if Cumulative is also set
ImPlotHistogramFlags_NoOutliers = 1 << 131 << 13exclude values outside the specified histogram range from the count toward normalizing and cumulative counts
ImPlotHistogramFlags_ColMajor = 1 << 141 << 14data will be read in column major order (not supported by PlotHistogram)

DigitalFlags_ (enum)

Flags for PlotDigital (placeholder). Used by setting ImPlotSpec::Flags.

MemberValue
ImPlotDigitalFlags_None = 00default

ImageFlags_ (enum)

Flags for PlotImage (placeholder). Used by setting ImPlotSpec::Flags.

MemberValue
ImPlotImageFlags_None = 00default

TextFlags_ (enum)

Flags for PlotText. Used by setting ImPlotSpec::Flags.

MemberValue
ImPlotTextFlags_None = 00default
ImPlotTextFlags_Vertical = 1 << 101 << 10text will be rendered vertically

DummyFlags_ (enum)

Flags for PlotDummy (placeholder). Used by setting ImPlotSpec::Flags.

MemberValue
ImPlotDummyFlags_None = 00default

Cond_ (enum)

Represents a condition for SetupAxisLimits etc. (same as ImGuiCond, but we only support a subset of those enums)

MemberValue
ImPlotCond_None = ImGuiCond_NoneCond_NoneNo condition (always set the variable), same as _Always
ImPlotCond_Always = ImGuiCond_AlwaysCond_AlwaysNo condition (always set the variable)
ImPlotCond_Once = ImGuiCond_OnceCond_OnceSet the variable once per runtime session (only the first call will succeed)

Col_ (enum)

Plot styling colors.

MemberValue
ImPlotCol_FrameBg0plot frame background color (defaults to ImGuiCol_FrameBg)
ImPlotCol_PlotBg1plot area background color (defaults to ImGuiCol_WindowBg)
ImPlotCol_PlotBorder2plot area border color (defaults to ImGuiCol_Border)
ImPlotCol_LegendBg3legend background color (defaults to ImGuiCol_PopupBg)
ImPlotCol_LegendBorder4legend border color (defaults to ImPlotCol_PlotBorder)
ImPlotCol_LegendText5legend text color (defaults to ImPlotCol_InlayText)
ImPlotCol_TitleText6plot title text color (defaults to ImGuiCol_Text)
ImPlotCol_InlayText7color of text appearing inside of plots (defaults to ImGuiCol_Text)
ImPlotCol_AxisText8axis label and tick labels color (defaults to ImGuiCol_Text)
ImPlotCol_AxisGrid9axis grid color (defaults to 25% ImPlotCol_AxisText)
ImPlotCol_AxisTick10axis tick color (defaults to AxisGrid)
ImPlotCol_AxisBg11background color of axis hover region (defaults to transparent)
ImPlotCol_AxisBgHovered12axis hover color (defaults to ImGuiCol_ButtonHovered)
ImPlotCol_AxisBgActive13axis active color (defaults to ImGuiCol_ButtonActive)
ImPlotCol_Selection14box-selection color (defaults to yellow)
ImPlotCol_Crosshairs15crosshairs color (defaults to ImPlotCol_PlotBorder)
ImPlotCol_COUNT16

StyleVar_ (enum)

Plot styling variables.

MemberValue
ImPlotStyleVar_PlotDefaultSize0ImVec2, default size used when ImVec2(0,0) is passed to BeginPlot
ImPlotStyleVar_PlotMinSize1ImVec2, minimum size plot frame can be when shrunk
ImPlotStyleVar_PlotBorderSize2float, thickness of border around plot area
ImPlotStyleVar_MinorAlpha3float, alpha multiplier applied to minor axis grid lines
ImPlotStyleVar_MajorTickLen4ImVec2, major tick lengths for X and Y axes
ImPlotStyleVar_MinorTickLen5ImVec2, minor tick lengths for X and Y axes
ImPlotStyleVar_MajorTickSize6ImVec2, line thickness of major ticks
ImPlotStyleVar_MinorTickSize7ImVec2, line thickness of minor ticks
ImPlotStyleVar_MajorGridSize8ImVec2, line thickness of major grid lines
ImPlotStyleVar_MinorGridSize9ImVec2, line thickness of minor grid lines
ImPlotStyleVar_PlotPadding10ImVec2, padding between widget frame and plot area, labels, or outside legends (i.e. main padding)
ImPlotStyleVar_LabelPadding11ImVec2, padding between axes labels, tick labels, and plot edge
ImPlotStyleVar_LegendPadding12ImVec2, legend padding from plot edges
ImPlotStyleVar_LegendInnerPadding13ImVec2, legend inner padding from legend edges
ImPlotStyleVar_LegendSpacing14ImVec2, spacing between legend entries
ImPlotStyleVar_MousePosPadding15ImVec2, padding between plot edge and interior info text
ImPlotStyleVar_AnnotationPadding16ImVec2, text padding around annotation labels
ImPlotStyleVar_FitPadding17ImVec2, 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_DigitalPadding18float, digital plot padding from bottom in pixels
ImPlotStyleVar_DigitalSpacing19float, digital plot spacing gap in pixels
ImPlotStyleVar_COUNT20

Scale_ (enum)

Axis scale

MemberValue
ImPlotScale_Linear = 00default linear scale
ImPlotScale_Time1date/time scale
ImPlotScale_Log102base 10 logarithmic scale
ImPlotScale_SymLog3symmetric log scale

Marker_ (enum)

Marker specifications.

MemberValue
ImPlotMarker_None = -2-2no marker
ImPlotMarker_Auto = -1-1automatic marker selection
ImPlotMarker_Circle0a circle marker (default)
ImPlotMarker_Square1a square maker
ImPlotMarker_Diamond2a diamond marker
ImPlotMarker_Up3an upward-pointing triangle marker
ImPlotMarker_Down4an downward-pointing triangle marker
ImPlotMarker_Left5an leftward-pointing triangle marker
ImPlotMarker_Right6an rightward-pointing triangle marker
ImPlotMarker_Cross7a cross marker (not fill-able)
ImPlotMarker_Plus8a plus marker (not fill-able)
ImPlotMarker_Asterisk9a asterisk marker (not fill-able)
ImPlotMarker_Vertical10a vertical line marker (not fill-able)
ImPlotMarker_Horizontal11a horizontal line marker (not fill-able)
ImPlotMarker_COUNT12

Colormap_ (enum)

Built-in colormaps

MemberValue
ImPlotColormap_Deep = 00a.k.a. seaborn deep (qual=True, n=10) (default)
ImPlotColormap_Dark = 11a.k.a. matplotlib “Set1” (qual=True, n=9 )
ImPlotColormap_Pastel = 22a.k.a. matplotlib “Pastel1” (qual=True, n=9 )
ImPlotColormap_Paired = 33a.k.a. matplotlib “Paired” (qual=True, n=12)
ImPlotColormap_Viridis = 44a.k.a. matplotlib “viridis” (qual=False, n=11)
ImPlotColormap_Plasma = 55a.k.a. matplotlib “plasma” (qual=False, n=11)
ImPlotColormap_Hot = 66a.k.a. matplotlib/MATLAB “hot” (qual=False, n=11)
ImPlotColormap_Cool = 77a.k.a. matplotlib/MATLAB “cool” (qual=False, n=11)
ImPlotColormap_Pink = 88a.k.a. matplotlib/MATLAB “pink” (qual=False, n=11)
ImPlotColormap_Jet = 99a.k.a. MATLAB “jet” (qual=False, n=11)
ImPlotColormap_Twilight = 1010a.k.a. matplotlib “twilight” (qual=False, n=11)
ImPlotColormap_RdBu = 1111red/blue, Color Brewer (qual=False, n=11)
ImPlotColormap_BrBG = 1212brown/blue-green, Color Brewer (qual=False, n=11)
ImPlotColormap_PiYG = 1313pink/yellow-green, Color Brewer (qual=False, n=11)
ImPlotColormap_Spectral = 1414color spectrum, Color Brewer (qual=False, n=11)
ImPlotColormap_Greys = 1515white/black (qual=False, n=2 )

Location_ (enum)

Used to position items on a plot (e.g. legends, labels, etc.)

MemberValue
ImPlotLocation_Center = 00center-center
ImPlotLocation_North = 1 << 01 << 0top-center
ImPlotLocation_South = 1 << 11 << 1bottom-center
ImPlotLocation_West = 1 << 21 << 2center-left
ImPlotLocation_East = 1 << 31 << 3center-right
ImPlotLocation_NorthWest = ImPlotLocation_North | ImPlotLocation_WestLocation_North | Location_Westtop-left
ImPlotLocation_NorthEast = ImPlotLocation_North | ImPlotLocation_EastLocation_North | Location_Easttop-right
ImPlotLocation_SouthWest = ImPlotLocation_South | ImPlotLocation_WestLocation_South | Location_Westbottom-left
ImPlotLocation_SouthEast = ImPlotLocation_South | ImPlotLocation_EastLocation_South | Location_Eastbottom-right

Bin_ (enum)

Enums for different automatic histogram binning methods (k = bin count or w = bin width)

MemberValue
ImPlotBin_Sqrt = -1-1k = sqrt(n)
ImPlotBin_Sturges = -2-2k = 1 + log2(n)
ImPlotBin_Rice = -3-3k = 2 * cbrt(n)
ImPlotBin_Scott = -4-4w = 3.49 * sigma / cbrt(n)

Spec (struct)

Plot item styling specification. Provide these to PlotX functions to override styling, specify offsetting or stride, or set optional flags. This struct can be used in the following ways:

  1. By declaring and defining a struct instance:

   ImPlotSpec spec;
   spec.LineColor = ImVec4(1,0,0,1);
   spec.LineWeight = 2.0;
   spec.Marker = ImPlotMarker_Circle;
   spec.Flags = ImPlotItemFlags_NoLegend | ImPlotLineFlags_Segments;
   ImPlot::PlotLine("MyLine", xs, ys, 100, spec);
  1. 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.

Point (struct)

Member
double x,
y;
Point::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);

Range (struct)

Range defined by a min/max value.

Member
double Min,
Max;
Range::ImPlotRange
constexpr ImPlotRange() : Min(0.0), Max(0.0);
constexpr ImPlotRange(double _min, double _max) : Min(_min), Max(_max);
Range::Contains
IMPLOT_API bool Contains(double value) const;
Range::Size
IMPLOT_API double Size() const;
Range::Clamp
IMPLOT_API double Clamp(double value) const;

Rect (struct)

Combination of two range limits for X and Y axes. Also an AABB defined by Min()/Max().

Member
ImPlotRange X,
Y;
Rect::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);
Rect::Contains
IMPLOT_API bool Contains(const ImPlotPoint& p) const;
IMPLOT_API bool Contains(double x, double y) const;
Rect::Size
IMPLOT_API ImPlotPoint Size() const;
Rect::Clamp
IMPLOT_API ImPlotPoint Clamp(const ImPlotPoint& p) const;
IMPLOT_API ImPlotPoint Clamp(double x, double y) const;
Rect::Min
IMPLOT_API ImPlotPoint Min() const;
Rect::Max
IMPLOT_API ImPlotPoint Max() const;

Style (struct)

Plot 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
Style::Color_
inline IMPLOT_API ImVec4& Color_(size_t idxColor);

Array of styling colors (index from implot.Col_.xxx)

Style::SetColor_
inline IMPLOT_API void SetColor_(size_t idxColor, ImVec4 color);

Array of styling colors (index from implot.Col_.xxx)

Style::ImPlotStyle
IMPLOT_API ImPlotStyle();

Support for legacy versions

InputMap (struct)

Input 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
InputMap::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);

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:

ImPlot::EndPlot

IMPLOT_API void EndPlot();

Only call EndPlot() if BeginPlot() returns True! Typically called at the end of an if statement conditioned on BeginPlot(). See example above.

Begin/End Subplots

SubplotsRowColRatios (struct)

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();

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);

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:

ImPlot::SetupAxisLimits

IMPLOT_API void SetupAxisLimits(ImAxis axis, double v_min, double v_max, ImPlotCond cond = ImPlotCond_Once);

Sets an axis range limits. If ImPlotCond_Always is used, the axes limits will be locked. Inversion with v_min > v_max is not supported; use SetupAxisLimits instead.

IMPLOT_API inline void SetupAxisLinks(ImAxis axis, BoxedValue* link_min, BoxedValue* link_max);

Links an axis range limits to external values. Use BoxedValue to transmit values (which will be updated after EndPlot).

ImPlot::SetupAxisFormat

IMPLOT_API void SetupAxisFormat(ImAxis axis, const char* fmt);

Sets the format of numeric axis labels via formatter specifier (default=“%g”). Formatted values will be double (i.e. use %f).

ImPlot::SetupAxisScale

IMPLOT_API void SetupAxisScale(ImAxis axis, ImPlotScale scale);

Sets an axis’ scale using built-in options.

ImPlot::SetupAxisLimitsConstraints

IMPLOT_API void SetupAxisLimitsConstraints(ImAxis axis, double v_min, double v_max);

Sets an axis’ limits constraints.

ImPlot::SetupAxisZoomConstraints

IMPLOT_API void SetupAxisZoomConstraints(ImAxis axis, double z_min, double z_max);

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);

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);

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);

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 BeginPlot is needed (e.g. if using a preceding button or slider widget to change the plot limits). In this case, you can use the SetNext API below. While this is not as feature rich as the Setup API, most common needs are provided. These functions can be called anywhere except for inside of Begin/EndPlot. For example: if (ImGui::Button(“Center Plot”))

    ImPlot::SetNextPlotLimits(-1,1,-1,1);
if (ImPlot::BeginPlot(...)) {
    ...
    ImPlot::EndPlot();
}

Important notes:

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());

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:

  1. 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});
  1. 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());

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());

Note: all array arguments must share the same dtype (e.g. xs = xs.astype(ys.dtype)).

Plots a bubble graph. #szs are the radius of each bubble in plot units.

ImPlot::PlotPolygon

IMPLOT_TMP void PlotPolygon(const char* label_id, const T* xs, const T* ys, int count, const ImPlotSpec& spec=ImPlotSpec());

Plots a polygon. Points are specified in counter-clockwise order. If concave, make sure to set the Concave flag.

Note: all array arguments must share the same dtype (e.g. xs = xs.astype(ys.dtype)).

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());

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());

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());

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());

Plots a group of bars.

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());

Note: all array arguments must share the same dtype (e.g. xs = xs.astype(ys.dtype)).

Plots vertical error bar. The label_id should be the same as the label_id of the associated line or bar plot.

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());

Plots stems. Vertical by default.

ImPlot::PlotInfLines

IMPLOT_TMP void PlotInfLines(const char* label_id, const T* values, int count, const ImPlotSpec& spec=ImPlotSpec());

Plots infinite vertical or horizontal lines (e.g. for references or asymptotes).

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());

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());

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());

Plots two dimensional, bivariate histogram as a heatmap. #x_bins and #y_bins can be a positive integer or an ImPlotBin. If #range is left unspecified, the min/max of
#xs an #ys will be used as the ranges. Otherwise, outlier values outside of range are not binned. The largest bin count or density is returned.

Note: all array arguments must share the same dtype (e.g. xs = xs.astype(ys.dtype)).

ImPlot::PlotDigital

IMPLOT_TMP void PlotDigital(const char* label_id, const T* xs, const T* ys, int count, const ImPlotSpec& spec=ImPlotSpec());

Note: all array arguments must share the same dtype (e.g. xs = xs.astype(ys.dtype)).

Plots digital data. Digital plots do not respond to y drag or zoom, and are always referenced to the bottom of the plot.

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());

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());

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());

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);

Shows a draggable point at x,y. #col defaults to ImGuiCol_Text.

The following can be used to render interactive elements and/or annotations.
Like the item plotting functions above, they apply to the current x and y axes, which can be changed with SetAxis/SetAxes. These functions return True when user interaction causes the provided coordinates to change. Additional user interactions can be retrieved through the optional output parameters.

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);

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);

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);

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, ...) ;

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, ...) ;

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, ...) ;

Shows a y-axis tag at the specified coordinate value.

Plot Utils

ImPlot::SetAxis

IMPLOT_API void SetAxis(ImAxis axis);

Select which axis/axes will be used for subsequent plot elements.

ImPlot::SetAxes

IMPLOT_API void SetAxes(ImAxis x_axis, ImAxis y_axis);

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);

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);

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);

Returns the current plot axis range.

ImPlot::IsPlotHovered

IMPLOT_API bool IsPlotHovered();

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();

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);

Returns the current plot box selection bounds. Passing IMPLOT_AUTO uses the current axes.

ImPlot::CancelPlotSelection

IMPLOT_API void CancelPlotSelection();

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);

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);

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();

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);

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();

Turns the current plot’s legend into a drag and drop target. Don’t forget to call EndDragDropTarget!

ImPlot::EndDragDropTarget

IMPLOT_API void EndDragDropTarget();

Ends a drag and drop target (currently just an alias for ImGui::EndDragDropTarget).

ImPlot::BeginDragDropSourcePlot

IMPLOT_API bool BeginDragDropSourcePlot(ImGuiDragDropFlags flags=0);

Turns the current plot’s plotting area into a drag and drop source. You must hold Ctrl. Don’t forget to call EndDragDropSource!

NB: By default, plot and axes drag and drop sources require holding the Ctrl modifier to initiate the drag.
You can change the modifier if desired. If ImGuiMod_None is provided, the axes will be locked from panning.

ImPlot::BeginDragDropSourceAxis

IMPLOT_API bool BeginDragDropSourceAxis(ImAxis axis, ImGuiDragDropFlags flags=0);

Turns the current plot’s X-axis into a drag and drop source. You must hold Ctrl. Don’t forget to call EndDragDropSource!

ImPlot::BeginDragDropSourceItem

IMPLOT_API bool BeginDragDropSourceItem(const char* label_id, ImGuiDragDropFlags flags=0);

Turns an item in the current plot’s legend into drag and drop source. Don’t forget to call EndDragDropSource!

ImPlot::EndDragDropSource

IMPLOT_API void EndDragDropSource();

Ends a drag and drop source (currently just an alias for ImGui::EndDragDropSource).

Styling

ImPlot::GetStyle

IMPLOT_API ImPlotStyle& GetStyle();

Styling colors in ImPlot works similarly to styling colors in ImGui, but with one important difference. Like ImGui, all style colors are stored in an indexable array in ImPlotStyle. You can permanently modify these values through
GetStyle().Colors, or temporarily modify them with Push/Pop functions below.
However, by default all style colors in ImPlot default to a special color
IMPLOT_AUTO_COL. IMPLOT_AUTO_COL tells ImPlot to set that color from color data in your ImGuiStyle. The ImGuiCol_ that these style colors default to are detailed above, and in general have been mapped to produce plots visually consistent with your current ImGui style. Of course, you are free to manually set these colors to whatever you like, and further can Push/Pop them around individual plots for plot-specific styling (e.g. coloring axes).
Provides access to plot style structure for permanent modifications to colors, sizes, etc.

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);

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);

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();

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();

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);

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);

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);

Undo temporary colormap modification(s). Undo multiple pushes at once by increasing count.

ImPlot::NextColormapColor

IMPLOT_API ImVec4 NextColormapColor();

Returns the next color from the current colormap and advances the colormap for the current plot.
Can also be used with no return value to skip colors if desired. You need to call this between Begin/EndPlot!

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);

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);

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);

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);

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);

Shows a button with a colormap gradient background.

ImPlot::BustColorCache

IMPLOT_API void BustColorCache(const char* plot_title_id = nullptr);

When items in a plot sample their color from a colormap, the color is cached and does not change unless explicitly overridden. Therefore, if you change the colormap after the item has already been plotted, item colors will NOT update. If you need item colors to resample the new colormap, then use this function to bust the cached colors. If #plot_title_id is None, then every item in EVERY existing plot will be cache busted. Otherwise only the plot specified by #plot_title_id will be busted. For the latter, this function must be called in the same ImGui ID scope that the plot is in. You should rarely if ever need this function, but it is available for applications that require runtime colormap swaps (e.g. Heatmaps demo).

Input Mapping

ImPlot::GetInputMap

IMPLOT_API ImPlotInputMap& GetInputMap();

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);

Render icons similar to those that appear in legends (nifty for data lists).

ImPlot::ColormapIcon

IMPLOT_API void ColormapIcon(ImPlotColormap cmap);

ImPlot::GetPlotDrawList

IMPLOT_API ImDrawList* GetPlotDrawList();

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);

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();

Pop plot clip rect. Call between Begin/EndPlot.

ImPlot::ShowStyleSelector

IMPLOT_API bool ShowStyleSelector(const char* label);

Shows ImPlot style selector dropdown menu.

ImPlot::ShowColormapSelector

IMPLOT_API bool ShowColormapSelector(const char* label);

Shows ImPlot colormap selector dropdown menu.

ImPlot::ShowInputMapSelector

IMPLOT_API bool ShowInputMapSelector(const char* label);

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();

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);

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.