# ImPlot
ImPlot is an immediate mode, GPU accelerated plotting library for [Dear ImGui](https://github.com/ocornut/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.
<img src="https://raw.githubusercontent.com/wiki/epezent/implot/screenshots3/controls.gif" width="270"> <img src="https://raw.githubusercontent.com/wiki/epezent/implot/screenshots3/dnd.gif" width="270"> <img src="https://raw.githubusercontent.com/wiki/epezent/implot/screenshots3/pie.gif" width="270">
<img src="https://raw.githubusercontent.com/wiki/epezent/implot/screenshots3/query.gif" width="270"> <img src="https://raw.githubusercontent.com/wiki/epezent/implot/screenshots3/bars.gif" width="270">
<img src="https://raw.githubusercontent.com/wiki/epezent/implot/screenshots3/rt.gif" width="270">
<img src="https://raw.githubusercontent.com/wiki/epezent/implot/screenshots3/stem.gif" width="270"> <img src="https://raw.githubusercontent.com/wiki/epezent/implot/screenshots3/markers.gif" width="270">
<img src="https://raw.githubusercontent.com/wiki/epezent/implot/screenshots3/shaded.gif" width="270">
<img src="https://raw.githubusercontent.com/wiki/epezent/implot/screenshots3/candle.gif" width="270"> <img src="https://raw.githubusercontent.com/wiki/epezent/implot/screenshots3/heat.gif" width="270">
<img src="https://raw.githubusercontent.com/wiki/epezent/implot/screenshots3/tables.gif" width="270">
## Features
- GPU accelerated rendering
- multiple plot types:
- line plots
- shaded plots
- scatter plots
- vertical/horizontal/stacked bars graphs
- vertical/horizontal error bars
- stem plots
- stair plots
- pie charts
- heatmap charts
- 1D/2D histograms
- images
- and more likely to come
- mix/match multiple plot items on a single plot
- configurable axes ranges and scaling (linear/log)
- subplots
- time formatted x-axes (US formatted or ISO 8601)
- reversible and lockable axes
- multiple x-axes and 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.
- 16 built-in colormaps and support for and user-added 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, or completely custom plot styles
- 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 [2022](https://github.com/epezent/implot/discussions/370)/[2021](https://github.com/epezent/implot/issues/168)/[2020](https://github.com/epezent/implot/issues/48))
## Usage
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!
```cpp
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);
...
ImPlot::EndPlot();
}
ImGui::End();
```
![Usage](https://raw.githubusercontent.com/wiki/epezent/implot/screenshots3/example.PNG)
Of course, there's much more you can do with ImPlot...
## Demos
A comprehensive example of ImPlot's features can be found in `implot_demo.cpp`. Add this file to your sources and call `ImPlot::ShowDemoWindow()` somewhere in your update loop. You are encouraged to use this file as a reference when needing to implement various plot types. The demo is always updated to show new plot types and features as they are added, so check back with each release!
An online version of the demo is hosted [here](https://traineq.org/implot_demo/src/implot_demo.html). 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](https://github.com/pthom) for creating and hosting this!
More sophisticated demos requiring lengthier code and/or third-party libraries can be found in a separate repository: [implot_demos](https://github.com/epezent/implot_demos). Here, you will find advanced signal processing and ImPlot usage in action. Please read the `Contributing` section of that repository if you have an idea for a new demo!
## Integration
0) Set up an [ImGui](https://github.com/ocornut/imgui) environment if you don't already have one.
1) 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](https://github.com/microsoft/vcpkg/tree/master/ports/implot).
2) Create and destroy an `ImPlotContext` wherever you do so for your `ImGuiContext`:
```cpp
ImGui::CreateContext();
ImPlot::CreateContext();
...
ImPlot::DestroyContext();
ImGui::DestroyContext();
```
You should be good to go!
## Installing ImPlot using vcpkg
You can download and install ImPlot using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
```bash
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install implot
```
The ImPlot port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
## Extremely Important Note
Dear ImGui uses **16-bit indexing by default**, so high-density ImPlot widgets like `ImPlot::PlotHeatmap()` may produce too many vertices into `ImDrawList`, which causes an assertion failure and will result in data truncation and/or visual glitches. Therefore, it is **HIGHLY** recommended that you EITHER:
- **Option 1:** Enable 32-bit indices by uncommenting `#define ImDrawIdx unsigned int` in your ImGui [`imconfig.h`](https://github.com/ocornut/imgui/blob/master/imconfig.h#L89) file.
- **Option 2:** Handle the `ImGuiBackendFlags_RendererHasVtxOffset` flag in your renderer if you must use 16-bit indices. Many of the default ImGui rendering backends already support `ImGuiBackendFlags_RendererHasVtxOffset`. Refer to [this issue](https://github.com/ocornut/imgui/issues/2591) for more information.
## FAQ
**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 with high levels of interactivity. 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 st
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
自己在学习IMgui的过程中,参照几个大哥的博客,试着做出来的样品菜单,该有的东西基本上都有 (146个子文件)
04f44b5486be90c7d445f9e93e102937870d03 64KB
064fdf28dba8dc779d7aedf3fe5a6bd4dfb376 32KB
0f1a124d50280c5af7ae70b64e873efc86c947 15KB
1191a6eff2711510727c55c6b7ed0baf58406a 288KB
1650ef136be1dd360585270c82b0e4f010fc40 18KB
1800df9ab682b17b7b056b5283468f1258dc95 154B
1d21dda88d680dcff8e806ed5e496ded100686 495B
25e50ee0b02470cc50d677b35cddf2a477548c 731B
2602811d6df5c30f0f3ed3a4a28f6aad29fcdb 63KB
2aa685c5d3a43b283f94ae783ca949885619d4 758B
2aca4bba8c938d3e54bcfec1bee4dc939eebd6 4KB
37ad922c0d587f5679b76751d832078646aed1 6KB
3d37899e4ecae1dec7411510a9d9f77988c1d9 59KB
3e0a9e96222732e48c924656a24e43fec410bd 116KB
40f0382e12e3a84295c5065c26516947ba26d7 2KB
428593624f46465601359ee92ecbb583a2b9e1 733B
47fd2f82eee908eaa972c93e54959da6f56ce7 5KB
4d1c63ba3f182024685ea81bb18a36dd66e0ce 238B
5433123bd52592e57663dc0b4397144f2fc414 23KB
5455b05cfd243ea865ac63a895abf7444b8fc0 125KB
56cbaf1be95c6e23f0f66f76aa64d5cb334438 4KB
5ea58601fb3a8481b07e4bf9a7d988d1653e76 68KB
715bdc84a16d041d3ffb001dcfcbebe9aa1989 666B
78c322019181ca12076843c2502e306baff012 2KB
7be292d6b16ea8d2a2a1b814ba0807245a1362 102KB
8470eeff11532332505d3e73aab440bb0f170b 178B
917e7a6e56a03dcee169bf4e08c32611b761c9 7KB
91a2fda28342ab358eaf234e1afe0c07a53d62 3KB
9292bb488c544fbfe03c0348bcc08e9df03e3f 103KB
95ef7c575125d09f59634c850c41a88ad532bc 655B
964683f32f4f92a7643f060f771fe3238469c5 1KB
a159dac73631b6c68ff6a8a7f175de09569c31 15KB
a9cf98a2bb9bc58c7c9a1d07cc042f325bb9de 242KB
b8147e2e019d9acab6305af45d573657523d13 10KB
c48616e91a4de4a41c4ccb2e71745903e91fb1 78KB
c71d829ca79e1e3696f0c138e6f0c1e382f64d 23KB
c827e6b9ee5f6ecc56e6e6f2ea19dcfd9dddd4 59KB
cb7cd555045f07307e7ca7f61cb4fad16f5949 71KB
COMMIT_EDITMSG 22B
config 930B
imgui.cpp 944KB
imgui.cpp 762KB
imgui_widgets.cpp 432KB
imgui_demo.cpp 426KB
imgui_widgets.cpp 415KB
implot.cpp 267KB
imgui_tables.cpp 230KB
imgui_draw.cpp 216KB
imgui_tables.cpp 215KB
imgui_draw.cpp 214KB
implot_items.cpp 120KB
implot_demo.cpp 111KB
imgui_impl_win32.cpp 60KB
imgui_impl_dx11.cpp 35KB
PureTest.cpp 20KB
d3a70ceaa69fb70811f58254dc738e0f939eac 89B
d77d1d6896b30176e52285048452a75a013f13 204B
dc2317666c0b7d1475abb93803ea7dac2931ff 151B
description 73B
df4a17d8e16d184fb53edbbd950a37e95220bf 66KB
dfefa20d8ed8288d2485486c3a21775da68cb1 526B
e0211cd0424c0b0d088d00adbc4163e5f4198c 70KB
e59bd42712b3a6624ae994a727fedbf5483c9f 117KB
.editorconfig 1KB
ef37a2780c79e56920091e3f380091599b25bc 18KB
exclude 240B
PureTest.exe 4.75MB
f0c423042b46cb1d617b81efb715defbe8054d 751B
f20a9e32fc7e2a51a791407c428d9821445992 456B
f3eb1e8a90cb6534c006e231d264c7b02b0359 3.37MB
f794a5f767309a2b2a801bbf52c5b6df14a466 179B
f8ff5140ae05225b856a3a6c614dd33c34467d 500B
PureTest.vcxproj.filters 3KB
.gitattributes 3KB
.gitattributes 397B
.gitignore 6KB
.gitignore 1KB
Font.h 8.32MB
imgui.h 323KB
imgui.h 319KB
imgui_internal.h 249KB
imgui_internal.h 233KB
imstb_truetype.h 200KB
imstb_truetype.h 195KB
implot.h 78KB
implot_internal.h 66KB
imstb_textedit.h 55KB
imstb_textedit.h 54KB
imstb_rectpack.h 20KB
imstb_rectpack.h 20KB
imconfig.h 10KB
imconfig.h 10KB
imgui_impl_win32.h 3KB
imgui_impl_dx11.h 1KB
PureTest.h 483B
HEAD 334B
HEAD 23B
vc143.idb 635KB
PureTest.ilk 3.89MB
index 4KB
共 146 条
- 1
- 2
资源评论
快乐的小哈皮
- 粉丝: 22
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功