Advanced 2D Plotting for Dear ImGui



ImPlot is an immediate mode, GPU accelerated plotting library for Dear ImGui. It aims to provide a first-class API that ImGui fans will love. ImPlot is well suited for visualizing program data in real-time or creating interactive plots, and requires minimal code to integrate. Just like ImGui, it does not burden the end user with GUI state management, avoids STL containers and C++ headers, and has no external dependencies except for ImGui itself.


  • GPU accelerated rendering
  • multiple plot types:
    • line plots
    • shaded plots
    • scatter plots
    • vertical/horizontal bars graphs
    • vertical/horizontal error bars
    • stem plots
    • stair plots
    • pie charts
    • heatmap charts
    • images
    • and more likely to come
  • mix/match multiple plot items on a single plot
  • configurable axes ranges and scaling (linear/log)
  • time formatted x-axes (US formatted or ISO 8601)
  • reversible and lockable axes
  • up to three independent y-axes
  • controls for zooming, panning, box selection, and auto-fitting data
  • controls for creating persistent query ranges (see demo)
  • several plot styling options: 10 marker types, adjustable marker sizes, line weights, outline colors, fill colors, etc.
  • 10 built-in and user definable colormaps
  • optional plot titles, axis labels, and grid labels
  • optional and configurable legends with toggle buttons to quickly show/hide plot items
  • default styling based on current ImGui theme, but most elements can be customized independently
  • customizable data getters and data striding (just like ImGui:PlotLine)
  • accepts data as float, double, and 8, 16, 32, and 64-bit signed/unsigned integral types
  • and more! (see Announcements 2020/2021)


The API is used just like any other ImGui BeginX/EndX pair. First, start a new plot with ImPlot::BeginPlot(). Next, plot as many items as you want with the provided PlotX functions (e.g. PlotLine(), PlotBars(), PlotScatter(), etc). Finally, wrap things up with a call to ImPlot::EndPlot(). That's it!

int   bar_data[11] = ...;
float x_data[1000] = ...;
float y_data[1000] = ...;

ImGui::Begin("My Window");
if (ImPlot::BeginPlot("My Plot")) {
    ImPlot::PlotBars("My Bar Plot", bar_data, 11);
    ImPlot::PlotLine("My Line Plot", x_data, y_data, 1000);


Of course, there's much more you can do with ImPlot. Consult implot_demo.cpp for a comprehensive example of ImPlot's features.

Interactive Demo

An online version of the demo is hosted here. You can view the plots and the source code that generated them. Note that this demo may not always be up to date and is not as performant as a desktop implementation, but it should give you a general taste of what's possible with ImPlot. Special thanks to pthom for creating and hosting this!


  1. Set up an ImGui environment if you don't already have one.
  2. Add implot.h, implot_internal.h, implot.cpp, implot_items.cpp and optionally implot_demo.cpp to your sources. Alternatively, you can get ImPlot using vcpkg.
  3. Create and destroy an ImPlotContext wherever you do so for your ImGuiContext:

You should be good to go!

If you want to test ImPlot quickly, consider trying mahi-gui, which bundles ImGui, ImPlot, and several other packages for you.

Special Notes

  • If you experience data truncation and/or visual glitches, it is HIGHLY recommended that you EITHER:
    1. Handle the ImGuiBackendFlags_RendererHasVtxOffset flag in your renderer when using 16-bit indices (the official OpenGL3 renderer supports this) and use an ImGui version with patch [email protected], OR...
    2. Enable 32-bit indices by uncommenting #define ImDrawIdx unsigned int in your ImGui imconfig.h file.
  • By default, no anti-aliasing is done on line plots for performance gains. If you use 4x MSAA, then you likely won't even notice. However, you can enable software AA per-plot with the ImPlotFlags_AntiAliased flag, or globally with ImPlot::GetStyle().AntiAliasedLines = true;.
  • Like ImGui, it is recommended that you compile and link ImPlot as a static library or directly as a part of your sources. However, if you are compiling ImPlot and ImGui as separate DLLs, make sure you set the current ImGui context with ImPlot::SetImGuiContext(ImGuiContext* ctx). This ensures that global ImGui variables are correctly shared across the DLL boundary.


Q: Why?

A: ImGui is an incredibly powerful tool for rapid prototyping and development, but provides only limited mechanisms for data visualization. Two dimensional plots are ubiquitous and useful to almost any application. Being able to visualize your data in real-time will give you insight and better understanding of your application.

Q: Is ImPlot the right plotting library for me?

A: If you're looking to generate publication quality plots and/or export plots to a file, ImPlot is NOT the library for you. ImPlot is geared toward plotting application data at realtime speeds. ImPlot does its best to create pretty plots (indeed, there are quite a few styling options available), but it will always favor function over form.

Q: Where is the documentation?

A: The API is thoroughly commented in implot.h, and the demo in implot_demo.cpp should be more than enough to get you started.

Q: Is ImPlot suitable for plotting large datasets?

A: Yes, within reason. You can plot tens to hundreds of thousands of points without issue, but don't expect millions to be a buttery smooth experience. That said, you can always downsample extremely large datasets by telling ImPlot to stride your data at larger intervals if needed.

Q: What data types can I plot?

A: ImPlot plotting functions accept most scalar types: float, double, int8, uint8, int16, uint16, int32, uint32, int64, uint64. Arrays of custom structs or classes (e.g. Vector2f or similar) are easily passed to ImPlot functions using the built in striding features (see implot.h for documentation).

Q: Can plot styles be modified?

A: Yes. Data colormaps and various styling colors and variables can be pushed/popped or modified permanently on startup. Three default styles are available, as well as an automatic style that attempts to match you ImGui style.

Q: Does ImPlot support logarithmic scaling or time formatting?

A: Yep! Both logscale and timescale are supported.

Q: Does ImPlot support multiple y-axes? x-axes?

A: Yes. Up to three y-axes can be enabled. Multiple x-axes are not supported.

Q: Does ImPlot support [insert plot type]?

A: Maybe. Check the demo, gallery, or Announcements (2020/2021)to see if your desired plot type is shown. If not, consider submitting an issue or better yet, a PR!

Q: Does ImPlot support 3D plots?

A: No, and likely never will since ImGui only deals in 2D rendering.

Q: My plot lines look like crap!

A: See the note about anti-aliasing under Special Notes above.

Q: Does ImPlot provide analytic tools?

A: Not exactly, but it does give you the ability to query plot sub-ranges, with which you can process your data however you like.

Q: Can plots be exported/saved to image?

A: Not currently. Use your OS's screen capturing mechanisms if you need to capture a plot. ImPlot is not suitable for rendering publication quality plots; it is only intended to be used as a visualization tool. Post-process your data with MATLAB or matplotlib for these purposes.

Q: Can ImPlot be used with other languages/bindings?

A: Yes, you can use the generated C binding, cimplot with most high level languages. DearPyGui provides a Python wrapper, among other things. A Rust binding, implot-rs, is currently in the works. An example using Emscripten can be found here.

  • Visualisation Improvement ideas/fixes

    Visualisation Improvement ideas/fixes

    1.) Minor ticks should not suddenly become major ticks, but gradually blend into major ticks. New minor ticks should blend in out of completely transparent ones. This will look much nicer when you do zooming, especially very rapid zooming. The point is not to have sudden changes in an image 2.) Add very mild animation on zooming - instead of sudden changes in zoom, zoom in gradually, starting at very fast speed, and slowing down when reaching zoom target, play the whole animation within 0.5-0.8second so it is still as sharp and responsive and not annoying. Also put it on a flag 3.) When zooming in, amount of digits for each tick grows and at some point they start to overlap. image I suggest skipping outputting text for ticks which will overlap with previous tick, with preference for major ticks of course.

    opened by sergeyn 45
  • Add GPU-accelerated heatmaps

    Add GPU-accelerated heatmaps

    As promised in #219, I managed to implement GPU-accelerated heatmaps! I haven't done any serious benchmarks but the performance gains I've seen in some applications are quite significant.

    This PR is pretty much ready to be merged, but there are some small issues that should be addressed:

    1. OpenGL doesn't support double nor *int64_t (aka ImU64/ImS64). If this kind of data is passed to a heatmap, it is internally converted to float or ImU32/ImS32 (respectively).
    2. When using OpenGL acceleration, the interpolation tables for heatmaps are unnecessary. Maybe we could only enable them in case this optimization is disabled
    3. Right now I use the same trick ImGui's main.cpp file uses to access OpenGL functions, which is rely on a macro definition to include one of the many supported libraries. It is possible to implement our own OpenGL loader so that we don't rely on any external library (ImGui will still depend on that library though), but that would add a bit of complexity maybe.
    4. Log-Log, Lin-Log and Log-Lin axis are not yet implemented.

    I tried to implement this as straightforward as possible, and with as little modifications to the 'core' of the library as possible. Also, all the implementation details are inside the file backends/implot_opengl.cpp. If the macro IMPLOT_ENABLE_OPENGL3_ACCELERATION is defined, then that file will compile and the library will use the shader-accelerated code. If not, it will default to the current method.

    I will update this PR once I have some benchmarks to show you, but the performance gains should be significant :)

    Any comments, optimizations, questions or changes are always welcome :D

    opened by marcizhu 40
  • Multi-Axis Support

    Multi-Axis Support

    Moving discussions of multi-axis support to a separate issue. Previous comments below:

    opened by epezent 36
  • Support for other dataset types

    Support for other dataset types

    I wish I could use ImPlot for audio data, which e.g. Spotify delivers as Int16 (signed) interleaved samples, which feed to the audio device as same. My FFTs yield integer ranges as well. I'd rather avoid converting entire blocks of ints to floats for trivial display, simply to skirt a library inflexibility.

    ImPlot's core piece - the data it operates on and that data's type - being limited to floating point is a fundamental inconvenience. @ocornut's suggestion to templatize the datatype internally, then expose type-specific APIs, seemed to be summarily dismissed.

    @epezent you mentioned there that templates "make the header a mess" but the dual "float then double" repeated function prototypes don't seem elegant either. Does anyone else have need for different dataset types? Surely someone has. I'm considering a fork to investigate a templated approach but would rather not repeat someone else's failed attempt at wheel reinvention. :-)

    By the way, @epezent, nice work on this! It looks great.

    opened by electromaggot 35
  • Announcements and New Features (2020)

    Announcements and New Features (2020)

    Announcements of changes and new features will be posted here. Click Subscribe to the right to receive updates!


    opened by epezent 31
  • AlignedPlots: Y/X axis padding over multiple plots

    AlignedPlots: Y/X axis padding over multiple plots

    To have same Y axis padding, ImPlot::BeginSubPlots() must be called before 1st ImPlot::BeginPlot() and ImPlot::EndSubPlots() must be called after last ImPlot::EndPlot(). Peek 2020-11-10 22-44

    opened by ozlb 20
  • Candlestick chart

    Candlestick chart

    Hi. Thank you very much for such an amazing library! Would you mind to implement a candlestick chart? It would be great to have a function with signature like

    void PlotCandlestickChart(const char* label_id, const float* xs, const float* opens, const float* closes, const float* lows, const float* highs, int count, int offset, int stride)

    I have a very basic implementation which looks like this candles The implementation is very straightforward and based on the error bars code, but I can share it here if you want.

    Let me explain some problems I've faced here:

    1. As you can see, I use 2 colors for candles. The main problem is you cannot show a 2-colored marker in the legend box. I see 2 solutions here: either to support a multicolor markers in the legend, or use one color, but mark rising and falling candles with solid and hollow filling. I'm not sure what option is more suitable for implot.
    2. It would be great to be able to show a time on the X axis in some form.
    3. I'm not sure if this is a topic for implot, but it would be great to have some tools to show the candle parameters (OHLC values) when mouse is hovered or clicked the candle.

    Please let me know if I can help somehow. Thanks!

    plot type 
    opened by ddovod 19
  • [Proposition] Online interactive demonstration

    [Proposition] Online interactive demonstration

    Your library is truly awesome, congrats!

    When it come to C++ libraries, most of the time there is most of the time no easy way to get a working demonstration. First, you have to download the code setup the build environment, etc. There, C++ is lagging behind some other languages, especially on the web.

    However, emscripten can help a lot in this case. In order to tryr to fill this gap, I spent a few hours this afternoon in order to make an online demo of your library.

    It is live here, and the source code for this demo is on github.

    Here are some screenshots:

    implot demo: image

    source code browser with access to the different demos: image

    It runs at 120 fps, except for the benchmark (which I suspect is blocked because it may consume too much memory)

    If you are interested, you could may be use this in order to add an interactive demo in your Readme. Feel free to deploy the wasm files on any server of your choice.


    opened by pthom 17
  • Line rasteriation issues for dense plots

    Line rasteriation issues for dense plots

    When you have super dense plots (many points hit a pixel), you can see holes in the rasterization pattern. Consider following plot, which plots a line: ImPlot::PlotLine("line, [](void*, int idx) { float v = float( 3.0 * idx / (1000000 - 1)); return ImVec2(v, v); }, nullptr, 1000000); You can observe single pixels missing on a plot. I believe it's because triangles generated for line segments do not have exactly same coordinates. (PS. you need my million line PR for this to work)

    help wanted 
    opened by sergeyn 17
  • Box selection [Mac]

    Box selection [Mac]

    Hello! I'm a bit confused with the box selection process. Firstly, there is a line that ImPlotFlags_Selection flag was changed to ImPlotFlags_BoxSelect (see implot.cpp), but I can't find neither statement that ImPlotFlags_BoxSelect has been deleted, nor that it's being used in the code. So the main question is how to enable box selection/zooming?

    opened by kivicode 16
  • Performance impact of offset and stride / wrap around

    Performance impact of offset and stride / wrap around

    The problem

    Just indexing the data (patched out ImPosMod() with just idx) gives a 30% fps boost in the benchmark (mahi-gui) compared to the current implementation honouring offset, stride. Before ImPosMod() was patched into it, the custom getter function version was faster. To my testing the penalty of using a getter function versus raw array pointers (all without ImPosMod and OffsetAndStride()) is surprisingly low (I suspect because there is already a lot of function calls for drawing each data point anyways).

    ~~The~~ A Solution

    One way to improve this is to add overloads without offset and stride parameters (and special getters in implot_items.cpp) for all functions. This will lead to double the amount of template instantiations though. A leaner variant would be to add overloads just for the _G functions. This also gives about 30% more fps in the plots benchmark.

    If you have a better idea how to solve this I'm happy to rebase the PR.

    opened by JoelLinn 15
  • Add polar charts (enhancement)

    Add polar charts (enhancement)

    Please add to the library a "scatter" plot on polar axis. It will be good to have to choose a "scatter" view:

    1. Arc figures. Inspired by nttiny library and looks like this image

    2. Circle scatters. It looks like matplotlib scatter plot image

    opened by fmvin 0
  • Added new bindings for .NET

    Added new bindings for .NET

    That's my contribution to your project, bindings for .NET which, among other things, includes implot documentation directly from within IntelliSense.

    Thank you, have a good year!

    opened by aybe 0
  • "Too many vertices in ImDrawList using 16-bit indices (LTTB solution?)

    I'm trying to plot data with hundreds of thousands of data points.

    It would be ideal to have implot incorporate an LTTB solution to automatically downsample data as the user zooms out / in of the data

    opened by navyenzo 1
  • PlotLine() is broken

    PlotLine() is broken

    The diff 63d5ed94b77acdf73201a00074bfd80467f50f0a introduced some breaking changes in how ImPlot::PlotLine() works.






    auto Sparkline = [](const char* id, const float* values, int count, float min_v, float max_v, int offset, const ImVec4& col,
                        const ImVec2& size) {
    	ImPlot::PushStyleVar(ImPlotStyleVar_PlotPadding, ImVec2(0, 0));
    	ImPlot::SetNextAxesLimits(0, count - 1, min_v, max_v, ImGuiCond_Always);
    	if (ImPlot::BeginPlot(id, size, ImPlotFlags_CanvasOnly | ImPlotFlags_NoChild)) {
    		ImPlot::SetupAxes(nullptr, nullptr, ImPlotAxisFlags_NoDecorations, ImPlotAxisFlags_NoDecorations);
    		ImPlot::PushStyleColor(ImPlotCol_Line, col);
    		ImPlot::PlotLine(id, values, count, 1, 0, offset);
    		ImPlot::PushStyleVar(ImPlotStyleVar_FillAlpha, 0.25f);
    		ImPlot::PlotShaded(id, values, count, 0, 1, 0, offset);
    opened by corporateshark 0
  • Persist legend location and flags

    Persist legend location and flags


    Thanks for this great library. I have a question: How do I persist the location and inside/outside flag of the legend so that if the app is closed and opened again the legend is still at the same position. Is there a method to query the state of the legend? Or something like SetupLegend(ImPlotLocation *location, ImPlotLegendFlags *flags) with references which modifies the current location and flags when the user configures the legend. Then location and flags could be saved on exit and loaded on start of the app.

    opened by Jochen0x90h 5
  • ImPlotPoint::operator[] bounds checking

    ImPlotPoint::operator[] bounds checking

    In implot.h, you have:

    // Double precision version of ImVec2 used by ImPlot. Extensible by end users.
    struct ImPlotPoint {
        double x, y;
        double  operator[] (size_t idx) const { return (&x)[idx]; }
        double& operator[] (size_t idx)       { return (&x)[idx]; }

    These functions do not do bounds checking and may thus read outside the struct's values. ImGui's ImVec2 does the following:

    struct ImVec2
        float                                   x, y;
        float  operator[] (size_t idx) const    { IM_ASSERT(idx <= 1); return (&x)[idx]; }    // We very rarely use this [] operator, the assert overhead is fine.
        float& operator[] (size_t idx)          { IM_ASSERT(idx <= 1); return (&x)[idx]; }    // We very rarely use this [] operator, the assert overhead is fine.

    And additionally has a pair of macros IM_MSVC_RUNTIME_CHECKS_OFF and IM_MSVC_RUNTIME_CHECKS_RESTORE that it wraps the struct with. Since implot.h imports imgui.h, you could directly use IM_ASSERT as well as the above other macros. Could you consider doing so?

    opened by dcnieho 0
  • v0.14(Sep 17, 2022)

    Plot Item Flags

    Each of ImPlot's PlotX functions now takes an optional ImPlotXFlags parameter. This decision (1) allows us to easily add more options for plot items and (2) allows us to consolidate and clean up some of the API. Here's what this looks like for PlotLine:

    // Flags for ANY PlotX function
    enum ImPlotItemFlags_ {
        ImPlotItemFlags_None     = 0,
        ImPlotItemFlags_NoLegend = 1 << 0, // the item won't have a legend entry displayed
        ImPlotItemFlags_NoFit    = 1 << 1, // the item won't be considered for plot fits
    // Flags for PlotLine
    enum ImPlotLineFlags_ {
        ImPlotLineFlags_None        = 0,       // default
        ImPlotLineFlags_Segments    = 1 << 10, // a line segment will be rendered from every two consecutive points
        ImPlotLineFlags_Loop        = 1 << 11, // the last and first point will be connected to form a closed loop
        ImPlotLineFlags_SkipNaN     = 1 << 12, // NaNs values will be skipped instead of rendered as missing data
        ImPlotLineFlags_NoClip      = 1 << 13, // markers (if displayed) on the edge of a plot will not be clipped
    void PlotLine(const char* label_id, const T* xs, const T* ys, int count, ImPlotLineFlags flags=0, int offset=0, int stride=sizeof(T));

    As you can see, PlotLine has some new bells and whistles that are enabled with the ImPlotLineFlags_ parameter, like rendering lines as segments or as a closed loop. Several other plotters have also gained new abilities through their respective flags (see the full list below). The special flags in ImPlotItemFlags can be combined with ANY ImPlotXFlags, e.g. ImPlotItemFlags_NoLegend|ImPlotLineFlags_Segments is valid code.

    Here's a complete list of flags available for our current plotters:

    ImPlotItemFlags_NoLegend         // the item won't have a legend entry displayed
    ImPlotItemFlags_NoFit            // the item won't be considered for plot fits
    ImPlotLineFlags_Segments         // a line segment will be rendered from every two consecutive points
    ImPlotLineFlags_Loop             // the last and first point will be connected to form a closed loop
    ImPlotLineFlags_SkipNaN          // NaNs values will be skipped instead of rendered as missing data
    ImPlotLineFlags_NoClip           // markers (if displayed) on the edge of a plot will not be clipped
    ImPlotScatterFlags_NoClip        // markers on the edge of a plot will not be clipped
    ImPlotStairsFlags_PreStep        // 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]
    ImPlotBarsFlags_Horizontal       // bars will be rendered horizontally on the current y-axis
    ImPlotBarGroupsFlags_Horizontal  // bar groups will be rendered horizontally on the current y-axis
    ImPlotBarGroupsFlags_Stacked     // items in a group will be stacked on top of each other
    ImPlotErrorBarsFlags_Horizontal  // error bars will be rendered horizontally on the current y-axis
    ImPlotStemsFlags_Horizontal      // stems will be rendered horizontally on the current y-axis
    ImPlotInfLinesFlags_Horizontal   // lines will be rendered horizontally on the current y-axis
    ImPlotPieChartFlags_Normalize    // force normalization of pie chart values (i.e. always make a full circle if sum < 0)
    ImPlotHeatmapFlags_ColMajor      // data will be read in column major order
    ImPlotHistogramFlags_Horizontal  // histogram bars will be rendered horizontally (not supported by PlotHistogram2D)
    ImPlotHistogramFlags_Cumulative  // each bin will contain its count plus the counts of all previous bins (not supported by PlotHistogram2D)
    ImPlotHistogramFlags_Density     // counts will be normalized, i.e. the PDF will be visualized, or the CDF will be visualized if Cumulative is also set
    ImPlotHistogramFlags_NoOutliers  // exclude values outside the specifed histogram range from the count toward normalizing and cumulative counts
    ImPlotHistogramFlags_ColMajor    // data will be read in column major order (not supported by PlotHistogram)
    ImPlotTextFlags_Vertical         // text will be rendered vertically

    SUPER IMPORTANT NOTE: Each PlotX function's ImPlotLineFlags flags=0 parameter has been positioned before int offset=0, int stride=sizeof(T) where applicable. This unfortunately means that folks making use of offset and/or stride will need to update their function calls to include a flags parameter, else they will likely see strange results or crashes without any warning. This may rub some users the wrong way, but it was a necessary evil as it stylistically makes the most sense for the flags parameter to take priority over stride and offset in the default argument order for most use cases and users.

    Besides that, items flags brings about a few other API breaking changes users should be aware of:

    • PlotBarsH has been removed; use PlotBars + ImPlotBarsFlags_Horizontal instead
    • PlotErrorBarsH has been removed; use PlotErrorBars + ImPlotErrorBarsFlags_Horizontal
    • PlotVLines and PlotHLines replaced with PlotInfLines (+ ImPlotInfLinesFlags_Horizontal )
    • PlotHistogram/PlotHistogram2D signatures changed; cumulative, density, and outliers options now specified via ImPlotHistogramFlags
    • PlotPieChart signature changed; normalize option now specified via ImPlotPieChartFlags
    • PlotText signature changes; vertical option now specified via ImPlotTextFlags_Vertical

    Again, this change will likely cause headaches for some users, but with this new system in place you can expect more plotting options to be added in future updates in a flexible and, importantly, maintainable way. Thanks for understanding.


    Previously, users could define time and log scales with ImPlotAxisFlags_Log, and ImPlotAxisFlags_Time. These flags have been replaced with a more general system using a new the setup function SetupAxisScale:

    // Axis scale
    enum ImPlotScale_ {
        ImPlotScale_Linear = 0, // default linear scale
        ImPlotScale_Time,       // date/time scale
        ImPlotScale_Log10,      // base 10 logartithmic scale
        ImPlotScale_SymLog,     // symmetric log scale
    // Sets an axis' scale using built-in options.
    void SetupAxisScale(ImAxis axis, ImPlotScale scale);

    ImPlotScale_SymLog is a new scale that produces a symmertic log scale with a linear region roughly between -1 and 1:


    More built-in scales may be added in the future. Until then, you can also now define YOUR OWN scales using ImPlotTransform to provide a forward and inverse function:

    // Callback signature for axis transform.
    typedef double (*ImPlotTransform)(double value, void* user_data);
    // Sets an axis' scale using user supplied forward and inverse transfroms.
    void SetupAxisScale(ImAxis axis, ImPlotTransform forward, ImPlotTransform inverse, void* data=NULL);


    static inline double TransformForward_Sqrt(double v, void*) {
        return sqrt(v);
    static inline double TransformInverse_Sqrt(double v, void*) {
        return v*v;
    if (ImPlot::BeginPlot("Sqrt")) {
        ImPlot::SetupAxis(ImAxis_X1, "Linear");
        ImPlot::SetupAxis(ImAxis_Y1, "Sqrt");
        ImPlot::SetupAxisScale(ImAxis_Y1, TransformForward_Sqrt, TransformInverse_Sqrt);


    New Axis Constraints

    You can now constrain axes limits so that users can't pan beyond a min or max value, or zoom beyond a min or max width/height. This is nice if you don't want users straying away from displayed data or zooming too far into view. It is demonstrated in the candlestick demo in implot_demo.cpp (see Custom Plotters and Tooltips).

    // Sets an axis' limits constraints.
    void SetupAxisLimitsConstraints(ImAxis axis, double v_min, double v_max);
    // Sets an axis' zoom constraints.
    void SetupAxisZoomConstraints(ImAxis axis, double z_min, double z_max);

    Customize Supported Types

    You can now customize the supported types by defining IMPLOT_CUSTOM_NUMERIC_TYPES at compile time to define your own type list. As an example, you could use the compile time define given by the line below in order to support only float and double.


    In order to support all known C++ types, use:

    -DIMPLOT_CUSTOM_NUMERIC_TYPES="(signed char)(unsigned char)(signed short)(unsigned short)(signed int)(unsigned int)(signed long)(unsigned long)(signed long long)(unsigned long long)(float)(double)(long double)"

    Special thanks to @pthom for inplementing this feature (#397) and greatly simplifying our plotter insantiation pipeline with some mean macro magic!

    Continuous Integration

    The ImPlot repository now provides CI through GitHub Actions. The jobs are setup to build ImPlot and a headless example application against the latest ImGui version across several compilers and platforms. Jobs are triggered for all new PRs.

    Special thanks to @rokups for setting this up (#395), @ozlb for the initial push (#393), @pthom for further improvements (#397), and @ocornut for his thoughtful comments.

    Misc. Improvements

    • Line plots now honor ImGui's AntiAliasedLines and AntiAliasedLinesUseTex. That's right, ImPlot now uses texture based AA! If you weren't using MSAA, you can now expect signficantly smoother lines for very little performance cost.
    • Markers and bar plots now render through ImPlot's custom render pipeline instead of ImGui's drawing API. This should speed up those plotters a good bit.
    • Compile times for implot_items.cpp should now be much quicker now.
    • Legend entries can be sorted using ImPlotLegendFlags_Sort
    Source code(tar.gz)
    Source code(zip)
  • v0.13(Jan 31, 2022)

    Setup API (see #272)

    Previously, setting up a plot and its axes was done by passing several args to BeginPlot and leveraging a handful of preceding SetNextXXX functions. The former was becoming unwieldy with BeginPlot requiring additional args for each newly introduced feature, while the latter was always awkward and a bit of a nightmare to manage under the hood. Neither approach offered room to scale the API gracefully.

    Taking a page out of ImGui's Tables API, plots and axes can now be configured by calling a host of optional SetupXXX functions immediately after BeginPlot. With this, the signature of BeginPlot has be greatly simplified. Here's a quick example:

    if (BeginPlot("My Plot",ImVec2(-1,-1),ImPlotFlags_Crosshairs) { // 1) begin a new plot
      SetupAxis(ImAxis_X1, "Time", ImPlotAxisFlags_Time);           // 2) make Setup calls
      SetupAxis(ImAxis_Y1, "My Y-Axis");
      SetupAxisLimits(ImAxis_Y1, 0, 1000);
      SetupAxisFormat(ImAxis_Y1, "$%.0f");
      SetupFinish();                                                // 3) [optional] explicitly finish setup
      PlotLine(...);                                                // 4) plot items
      EndPlot();                                                    // 5) end the plot

    All of the functionality you previously had with the original signature of BeginPlot and SetNextXXX is now available through the Setup API:

    // Begin a new plot. 
    bool BeginPlot(const char* title_id, const ImVec2& size = ImVec2(-1,0), ImPlotFlags flags = ImPlotFlags_None);
    // Enables an axis or sets the label and/or flags for an existing axis. Leave #label = NULL for no label.
    void SetupAxis(ImAxis axis, const char* label = NULL, ImPlotAxisFlags flags = ImPlotAxisFlags_None);
    // Sets an axis range limits. If ImPlotCond_Always is used, the axes limits will be locked.
    void SetupAxisLimits(ImAxis axis, double v_min, double v_max, ImPlotCond cond = ImPlotCond_Once);
    // Links an axis range limits to external values. Set to NULL for no linkage. The pointer data must remain valid until EndPlot.
    void SetupAxisLinks(ImAxis axis, double* link_min, double* link_max);
    // Sets the format of numeric axis labels via formater specifier (default="%g"). Formated values will be double (i.e. use %f).
    void SetupAxisFormat(ImAxis axis, const char* fmt);
    // Sets the format of numeric axis labels via formatter callback. Given #value, write a label into #buff. Optionally pass user data.
    void SetupAxisFormat(ImAxis axis, ImPlotFormatter formatter, void* data = NULL);
    // Sets an axis' ticks and optionally the labels. To keep the default ticks, set #keep_default=true.
    void SetupAxisTicks(ImAxis axis, const double* values, int n_ticks, const char* const labels[] = NULL, bool keep_default = false);
    // Sets an axis' ticks and optionally the labels for the next plot. To keep the default ticks, set #keep_default=true.
    void SetupAxisTicks(ImAxis axis, double v_min, double v_max, int n_ticks, const char* const labels[] = NULL, bool keep_default = false);
    // Sets the label and/or flags for primary X and Y axes (shorthand for two calls to SetupAxis).
    void SetupAxes(const char* x_label, const char* y_label, ImPlotAxisFlags x_flags = ImPlotAxisFlags_None, ImPlotAxisFlags y_flags = ImPlotAxisFlags_None);
    // 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).
    void SetupAxesLimits(double x_min, double x_max, double y_min, double y_max, ImPlotCond cond = ImPlotCond_Once);
    // Sets up the plot legend.
    void SetupLegend(ImPlotLocation location, ImPlotLegendFlags flags = ImPlotLegendFlags_None);
    // Set the location of the current plot's mouse position text (default = South|East).
    void SetupMouseText(ImPlotLocation location, ImPlotMouseTextFlags flags = ImPlotMouseTextFlags_None);
    // 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.
    void SetupFinish();

    A few 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 all it yourself, then the first subsequent plotting or utility function will call it for you.
    • The primary X and Y axis (ImAxis_X1 and ImAxis_Y1) are always enabled. To enable auxiliary axes, you must call, e.g. SetupAxis(ImAxis_Y2,...). This replaces the existing method of enabling auxiliary axes, i.e. passing ImPlotFlags_YAxis2/3.
    • Some SetNextXXX API has been removed or renamed; check the top of implot.cpp for changelogs
    • The original BeginPlot signature has been deprecated, and usage will result in compiler warnings. Please begin transitioning your code before its removal v1.0! You can define IMPLOT_DISABLE_OBSOLETE_FUNCTIONS to remove it now.

    New Axes Features

    The new Setup API allows us to easily extend and add functionality to axes. Here are a few new features you can start using today, with more expected to come in the near future.

    • support for multiple x-axes (up to 3 x-axes, and 3 y-axes)
      • ImAxis_ enums replace ImPlotYAxis_
      • SetAxis replaces SetPlotYAxis
    • place axes on opposite side with ImPlotAxisFlags_Opposite or simply by dragging the axis to the other side
    • new style colors: ImPlotCol_AxisBgHovered and ImPlotCol_AxisBgActive
    • when multiple x or y axes are enabled, hovering an item legend icon highlights the axes it is plotted on
    • axes use ImGui::ButtonBehavior under the hood for more robust interaction


    • custom tick label formatting via ImPlotFormatter callbacks passed to SetupAxisFormat
    • formatting is applied to mouse position text
    • context menus now display axis label name, if available


    Improved Tooling

    • Query has been removed and replaced with a more flexible tool, DragRect. Unlike the previous query system, these can be resized and multiple can exist in one plot. An example in the demo shows how you can convert plot selections in to new query rects.

    dragect dragect2

    • TagX and TagY have been added and allow you to add custom labels to axes. These use either the axis' formatter, or a custom provided string. You can combine these with other tools like DragLine to create custom interactivity.


    • DragPoint and DragLine no longer take a string ID. Instead they now expect an int ID, and as a result no longer display the optional label. Instead, use TagX/Y and Annotation to add labels too these tools if needed.
    • additional options for drag tools via ImPlotDragToolFlags


    • Bar plots can now be plotted in groups.
    • Bar groups can be stacked
    // Flags for ImPlot::PlotBarGroups
    enum ImPlotBarGroupsFlags_ {
        ImPlotBarGroupsFlags_None     = 0,      // default
        ImPlotBarGroupsFlags_Stacked  = 1 << 0, // items in a group will be stacked on top of each other
    // Plots a group of vertical bars. #values is a row-major matrix with #item_count rows and #group_count cols. #label_ids should have #item_count elements.
    void PlotBarGroups(const char* const label_ids[], const T* values, int item_count, int group_count, double group_width=0.67, double x0=0, ImPlotBarGroupsFlags flags=ImPlotBarGroupsFlags_None);
    // Plots a group of horizontal bars. #values is a row-major matrix with #item_count rows and #group_count cols. #label_ids should have #item_count elements.
    void PlotBarGroupsH(const char* const label_ids[], const T* values, int item_count, int group_count, double group_height=0.67, double y0=0, ImPlotBarGroupsFlags flags=ImPlotBarGroupsFlags_None);



    Return of ImPlotInputMap

    • ImPlotInputMap has been revamped and brought back into the public API, and two presets are now provided: Default and Reverse
    struct ImPlotInputMap {
        ImGuiMouseButton Pan;           // LMB    enables panning when held,
        ImGuiKeyModFlags 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
        ImGuiKeyModFlags SelectMod;     // none   optional modifier that must be held for box selection
        ImGuiKeyModFlags SelectHorzMod; // Alt    expands active box selection horizontally to plot edge when held
        ImGuiKeyModFlags SelectVertMod; // Shift  expands active box selection vertically to plot edge when held
        ImGuiMouseButton Menu;          // RMB    opens context menus (if enabled) when clicked
        ImGuiKeyModFlags OverrideMod;   // Ctrl   when held, all input is ignored; used to enable axis/plots as DND sources
        ImGuiKeyModFlags ZoomMod;       // none   optional modifier that must be held for scroll wheel zooming
        float            ZoomRate;      // 0.1f   zoom rate for scroll (e.g. 0.1f = 10% plot range every scroll click); make negative to invert
    // Provides access to input mapping structure for permanent modifications to controls for pan, select, etc.
    ImPlotInputMap& GetInputMap();
    // Default input mapping: pan = LMB drag, box select = RMB drag, fit = LMB double click, context menu = RMB click, zoom = scroll.
    void MapInputDefault(ImPlotInputMap* dst = NULL);
    // Reverse input mapping: pan = RMB drag, box select = LMB drag, fit = LMB double click, context menu = RMB click, zoom = scroll.
    void MapInputReverse(ImPlotInputMap* dst = NULL);

    Bug Fixes / Improvementss

    • fix Intel compiler warnings (#315)
    • replace sprintf/snprintf calls with ImFormatString for overridability (#310)
    • fix issues with striding when T != float (#303)
    • handle format-nonliteral warnings (#304)
    • fix issue with unitialized variables (#313)
    • make PlotText fitable (#286)
    Source code(tar.gz)
    Source code(zip)
  • v0.12(Oct 19, 2021)

  • v0.11(Jul 10, 2021)

  • v0.10(Jul 8, 2021)

    New Features

    • subplots, #203
    • aligned plots, #144
    • initial fit and auto fitting
    • custom tick label formatting

    Bug Fixes / Improvements

    • fix y-axis log scale for histograms and bar charts #244
    • fix SampleColormapU32 return value #213
    • fix GetColormapSize return value #241
    • add big warning about 16-bit ImDrawIdx to demo and README #228
    • fix potential division by zero #229
    • fix max inclusivity issue when fitting #236
    Source code(tar.gz)
    Source code(zip)
  • v0.9(Mar 21, 2021)

    New Features

    • PlotHistogram and PlotHistogram2D #148
    • PlotVLines / PlotHLines - plot infinite reference lines #166
    • ImPlotFlags_Equal - constrain x and y axes to have equal spacing #111 #147
    • ImPlotAxisFlags_AutoFit - auto fit axis all the time
    • Labels for auxiliary y-axes (thanks, @mindv0rtex!) #162, #163
    • Greatly enhanced drag and drop support
    • Colormap overhaul and widgets

    API Breaking Changes

    • ImPlotInputMap moved to implot_internal.h
    • SetColormap and PushColormap(ImVec4*) have been removed in favor of AddColormap
    • LerpColormap was changed to SampleColormap.
    • ShowColormapScale is now ColormapScale and requires a label and ImVec2 size. The label will be displayed as an axis label (see above).
    • BeginLegendDragDropSource was changed to BeginDragDropSourceItem

    Bug Fixes / Improvements

    • single rick-click context menus #170
    • heatmap performance improvements #148
    • date picker disabled color #174
    • fix formatting for axis labels near zero #176
    • improve fit logic for constant or flat data #154

    See #168 for more information and screenshots!

    Source code(tar.gz)
    Source code(zip)
  • v0.8(Oct 27, 2020)

    New Features / Changes

    • support for all typical scalar types
    • configurable legend locations
    • functions for adding annotations
    • tools for draggable reference lines and points
    • ISO 8601 date formatting for time axes
    • date/time pickers for time axes context menus
    • scale and offset args for single array plotting functions
    • PlotImage
    • PlotStairs

    See for more details.

    Bug Fixes / Improvements

    • fix seg-fault caused by SetColormap
    • fix compiler error caused by removal of DisplayOffset in ImGui
    Source code(tar.gz)
    Source code(zip)
  • v0.7(Sep 7, 2020)

    New Features / Changes

    • date/time formatting for X-Axes
    • linked axes
    • ImPlotFlags and ImPlotAxisFlags were simplified

    Bug Fixes / Improvements

    • improved axis constraints
    • updated README images
    Source code(tar.gz)
    Source code(zip)
  • v0.6(Sep 2, 2020)

    New Features / Changes:

    • add PlotStems

    Bug Fixes:

    • fix critical bug in v0.5 where marker sizes were incorrectly initialized and thus randomly not displayed
    Source code(tar.gz)
    Source code(zip)
  • v0.5(Sep 2, 2020)

    New Features / Changes:

    • Explicit ImPlotContexts and Major Refactors
    • Per Axis Context Menus
    • Styling Colors and Variables Overhaul
    • Built-In Style Colors
    • Next Item Styling Functions
    • Legend Popup and Drag and Drop Utilities
    • Candlestick Chart in Demo

    Bug Fixes:

    • make axes recover when zoom goes below epsilon
    • fix query rect only renders if flag is set
    • fix y-axis flags issues
    • fix integer overflow for 32-bit ImDrawIdx
    • make vertical text scaling and offset obey ImGui font settings
    Source code(tar.gz)
    Source code(zip)
  • v0.4(Aug 7, 2020)

    New Features / Changes:

    • introduced PlotShaded plotting functions
    • introduced ImPlotStyleVar_FillAlpha to scale fill alpha
    • plot items with the same label_id will be grouped in the legend
    • label_id s preceded by ## will not produce a legend entry
    • removed ImPlotFlags_Adaptive and ImPlotFlags_Cull
    • introduced ImPlotInputMap for remapping plot controls
    • introduced IsPlotXAxisHovered, IsPlotYAxisHovered, and IsLegendEntryHovered
    • online interactive demo added to README

    Bug Fixes:

    • fixed issues with heatmap bounds #80
    • fixed issues with axes states carrying over to subsequent plots #76
    • fixed issue with circular buffer rollover #60
    • fixed bugs in demo BenchmarkItem #62
    • fixed division by zero issues #78
    • fixed compliation issues on macOS #63

    See Announcements for more details.

    Source code(tar.gz)
    Source code(zip)
  • v0.3(Jun 13, 2020)

    New Features / Changes:

    • support for double precision data
    • built-in and customizable colormaps
    • heatmaps
    • user defined axis ticks and labels
    • horizontal error bars

    Bug Fixes:

    • 16-bit indices are now correctly rendered.

    See Announcements for more details.

    Special thanks: @sergeyn, @ChiefSeaBiscuit, @ocornut, @ozlb

    Source code(tar.gz)
    Source code(zip)
  • v0.2(May 29, 2020)

    New Features / Changes:

    • changed namespace from ImGui:: to ImPlot::
    • renamed several API functions and structs for consistent style and clarity
    • support multiple (up to 3) independent y-axes per plot
    • multi-level digital plots
    • negative data offsets
    • optimizations for high density lines
    • improved culling
    • improvements toward ImGui C++11 conformance

    Special thanks: @jpieper @ozlb @sergeyn @ocornut

    Source code(tar.gz)
    Source code(zip)
  • v0.1(May 11, 2020)

    Initial release. Features include:

    • multiple plot types:
      • line
      • scatter
      • vertical/horizontal bars
      • error bars
      • pie charts
      • digital plots
      • and more likely to come
    • mix/match multiple plot items on a single plot
    • configurable axes ranges and scaling (linear/log)
    • reversible and lockable axes
    • controls for zooming, panning, box selection, and auto-fitting data
    • controls for creating persistent query ranges (see demo)
    • several plot styling options: 10 marker types, adjustable marker sizes, line weights, outline colors, fill colors, etc.
    • optional plot titles, axis labels, and grid labels
    • optional legend with toggle buttons to quickly show/hide items
    • size-aware grid with smart labels that are always power-of-ten multiples of 1, 2, and 5
    • default styling based on current ImGui theme, but most elements can be customized independently
    • mouse cursor location display and optional crosshairs cursor
    • customizable data getters and data striding (just like ImGui:PlotLines)
    • relatively good performance for high density plots
    Source code(tar.gz)
    Source code(zip)
Evan Pezent
PhD candidate studying robotics in the Mechatronics and Haptic Interfaces Lab at Rice University.
Evan Pezent
Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies

Dear ImGui (This library is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addit

omar 44.5k Jan 7, 2023
Real-time GUI layout creator/editor for Dear ImGui

ImStudio Real-time GUI layout creator/editor for Dear ImGui Inspired by Code-Building/ImGuiBuilder Features Drag edit Property edit Covers most of the

null 303 Jan 9, 2023
Dear ImGui prototyping wrapper.

LabImGui Prototyping framework LabImGui wraps up creating a window, GL bindings, and a full screen docking set up with ImGui so that all of the boiler

Nick Porcino 1 Dec 5, 2022
An integrated information center created with dear ImGui using modern C++ design / coding style.

ImGui info-center Introduction An integrated notification and information center created with dear ImGui. Interfaces and variables are designed under

Feej 7 Oct 29, 2022
Addon widgets for GUI library Dear ImGui.

ImGui-Addons Addon widgets for GUI library Dear ImGui. File Dialog A simple cross-platform file dialog that uses dirent interface for reading director

null 286 Jan 7, 2023
This is a software renderer for Dear ImGui. I built it not out of a specific need, but because it was fun

Dear ImGui software renderer This is a software renderer for Dear ImGui. I built it not out of a specific need, but because it was fun. The goal was t

Emil Ernerfeldt 214 Dec 22, 2022
A permissively licensed markdown single-header library for Dear ImGui.

Support development of imgui_markdown through GitHub Sponsors or Patreon imgui_markdown Markdown For Dear ImGui A permissively licensed markdown singl

Juliette Foucaut 853 Jan 8, 2023
Window and GUI system based on Dear ImGui from OCornut

ImWindow Window and GUI system based on ImGui from OCornut. Include docking/floating window, multi window and multi render support. Platform Actually

Thibault Hennequin 715 Dec 20, 2022
Nice things to use along dear imgui

Mini hexadecimal editor! Right-click for option menu. Features: Keyboard controls. Read-only mode. Optional Ascii display. Optional HexII display. Goto address. Highlight range/function. Read/Write handlers.

omar 664 Jan 1, 2023
This is a thin c-api wrapper programmatically generated for the excellent C++ immediate mode gui Dear ImGui.

cimgui This is a thin c-api wrapper programmatically generated for the excellent C++ immediate mode gui Dear ImGui. All imgui.h functions are programm

Victor Bombi 22 Jul 5, 2021
Immediate mode 3D gizmo for scene editing and other controls based on Dear Imgui

ImGuizmo Latest stable tagged version is 1.83. Current master version is 1.84 WIP. What started with the gizmo is now a collection of dear imgui widge

Cedric Guillemet 2.3k Dec 27, 2022
Sample Unreal Engine 5.0.1 C++ Project That Incorporates Dear ImGui

UE5 With Dear ImGui A sample Unreal Engine 5.0.1 C++ project that incorporates the Dear ImGui graphical user interface library. YouTube Tutorial This

Kyle Geske 36 Dec 25, 2022
Simple ImGui external base. Uses ImGui DX9.

ImGui External Base ??️ What is this? ⚡ Hello all! I used to use noteffex's loader base for all my external ImGui projects. I got bored of using this

Alfie 11 Jun 29, 2022
An addon of imgui for supporting docks in the imgui's window

An addon of imgui for support dock in the window

BB 207 Nov 29, 2022
wxWidgets is a free and open source cross-platform C++ framework for writing advanced GUI applications using native controls.

About wxWidgets is a free and open source cross-platform C++ framework for writing advanced GUI applications using native controls. wxWidgets allows y

null 4.8k Jan 7, 2023
CMakeLists wrapper around imgui

ImGui Wrappings This is a trifold wrapper for the Dear ImGui library. Ease integration with CMake, Provide an RAII mechanism for ImGui scopes, Provide

Oliver Smith 39 Dec 8, 2022
super duper simple gui for C, wrapping imgui and stb

super duper simle gui for C, wrapping imgui and stb You can use it as a static library with cmake. See the example directory for a complete example. E

Rasmus 11 May 19, 2022
KeyAuth login form made with ImGui.

KeyAuth-ImGui-Example KeyAuth ImGui Example Download Repository Download the DirectX SDK

Lolys 23 Dec 16, 2022
ImGuiBase - A very good & simple external ImGui base

ImGuiBase Join CProject to learn about ImGui! Check out our website: Check out the youtube tutorial

null 25 Dec 23, 2022