mirror of
https://github.com/gwm17/implot.git
synced 2025-04-22 08:18:50 -04:00
Compare commits
137 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
18758e237e | ||
|
fb084f3719 | ||
|
33c5a965f5 | ||
|
d875123534 | ||
|
fcb51d2c9c | ||
|
626e391670 | ||
|
8879c99aef | ||
|
6978a3e177 | ||
|
15e494b76a | ||
|
f88ad32a47 | ||
|
3e13c95986 | ||
|
4ba42f200a | ||
|
57149164d5 | ||
|
9ef3a97966 | ||
|
921a81f307 | ||
|
8c06ff0252 | ||
|
98c76edbb4 | ||
|
f719a180ff | ||
|
49db527db1 | ||
|
fd16fe001c | ||
|
002ffc95bc | ||
|
e80e42e8b4 | ||
|
220f5c9ab4 | ||
|
7a470b2e17 | ||
|
f33a5990d7 | ||
|
1fed5c2c19 | ||
|
b4aec718a5 | ||
|
8c53333489 | ||
|
fc0fd11246 | ||
|
6c00109636 | ||
|
0f4d4dccc3 | ||
|
6f4986b14f | ||
|
dbb461db24 | ||
|
63d5ed94b7 | ||
|
79b05d5e25 | ||
|
b9c0a39b08 | ||
|
3dd7e75c7d | ||
|
947c2c02e4 | ||
|
32a4617cd6 | ||
|
196a0243c5 | ||
|
df4256c9e8 | ||
|
1160243218 | ||
|
b47c8bacdb | ||
|
58240e5311 | ||
|
9b4ba149ec | ||
|
f438a21813 | ||
|
86f4dd6e5c | ||
|
adfc96810e | ||
|
8d3bd31395 | ||
|
168244e422 | ||
|
3a53f0b796 | ||
|
199b4803b6 | ||
|
6659b164fe | ||
|
4fcc6e01ac | ||
|
c0da6fea04 | ||
|
6ee1559715 | ||
|
dea3387cdc | ||
|
c40206f2ea | ||
|
f1b86b9fe4 | ||
|
5ed9e78676 | ||
|
14d4c96d0c | ||
|
0fb3346a7a | ||
|
3e96fd7c02 | ||
|
c8601ac0d5 | ||
|
864ebb90b6 | ||
|
4be83def59 | ||
|
507459fd5f | ||
|
2dc2a4cfd5 | ||
|
83cb14b54a | ||
|
cd4704fd52 | ||
|
bffd448207 | ||
|
51930a5ae6 | ||
|
5ab78cbc7d | ||
|
eb40cc908d | ||
|
389781c31c | ||
|
8c1bbf4d8d | ||
|
65aa2c8264 | ||
|
ab24f756fa | ||
|
e9469cf347 | ||
|
0cafcd0011 | ||
|
3109940b46 | ||
|
4edb1c75b6 | ||
|
da1bf57136 | ||
|
e966e0d2bc | ||
|
450e5b80df | ||
|
dd78125bfb | ||
|
555ff688a8 | ||
|
04ae3728f8 | ||
|
27bc59eb43 | ||
|
1d674e7557 | ||
|
41a0e2c9fe | ||
|
707a0bee36 | ||
|
ed1baf471a | ||
|
4b0f9c9495 | ||
|
ab110ceec8 | ||
|
e5c457b326 | ||
|
ef6c55cd00 | ||
|
5db2ba3b22 | ||
|
7aab224742 | ||
|
db6b0356ee | ||
|
ccd29a646f | ||
|
95a530f05c | ||
|
eff70aeee0 | ||
|
eea12d6b4c | ||
|
1d9381a004 | ||
|
b85a2c0800 | ||
|
46ea9abab4 | ||
|
607703d2af | ||
|
b958abf459 | ||
|
dd2d9ce032 | ||
|
67e0876f89 | ||
|
7234801868 | ||
|
413fb083ad | ||
|
e64df657b2 | ||
|
6e2499093b | ||
|
c73509d6d1 | ||
|
798e2e7585 | ||
|
6f7bf5f38b | ||
|
5fd1ecdfd7 | ||
|
a6bab98517 | ||
|
5b59b47bae | ||
|
a9d3347915 | ||
|
fa10618df6 | ||
|
b22c21f912 | ||
|
9b5adca5f1 | ||
|
4af202a988 | ||
|
9974ce1a30 | ||
|
10a58c52ca | ||
|
b369d62f86 | ||
|
fa10a03a53 | ||
|
24b543839b | ||
|
95eb2ea78d | ||
|
af7d99cbca | ||
|
40cbe88673 | ||
|
48c0d6fe38 | ||
|
ad29c9a046 | ||
|
c942a400e4 |
95
.github/CMakeLists.txt
vendored
Normal file
95
.github/CMakeLists.txt
vendored
Normal file
|
@ -0,0 +1,95 @@
|
|||
# This build script is not meant for general use, it is for CI use only!
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(implot)
|
||||
|
||||
#
|
||||
# Global options
|
||||
#
|
||||
|
||||
# Same as Dear ImGui
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
# Arch option for linux
|
||||
if (NOT APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU" AND DEFINED GCC_ARCH)
|
||||
if ("${GCC_ARCH}" MATCHES "Win32|x86|32")
|
||||
add_compile_options(-m32)
|
||||
add_link_options(-m32)
|
||||
elseif ("${GCC_ARCH}" MATCHES "Win64|x64|64")
|
||||
add_compile_options(-m64)
|
||||
add_link_options(-m64)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Arch option for Mac: arm64 for M1 or x86_64 for intel (32 bits build are deprecated on Mac)
|
||||
if(APPLE AND DEFINED OSX_ARCH)
|
||||
if ("${OSX_ARCH}" MATCHES "x86_64")
|
||||
set(CMAKE_OSX_ARCHITECTURES "x86_64")
|
||||
elseif ("${OSX_ARCH}" MATCHES "arm64")
|
||||
set(CMAKE_OSX_ARCHITECTURES "arm64")
|
||||
else()
|
||||
message(FATAL_ERROR "Unhandled OSX_ARCH=${OSX_ARCH}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#
|
||||
# Dear ImGui library with no backend
|
||||
#
|
||||
|
||||
set(imgui_sources
|
||||
../imgui/imconfig.h
|
||||
../imgui/imgui.cpp
|
||||
../imgui/imgui.h
|
||||
../imgui/imgui_demo.cpp
|
||||
../imgui/imgui_draw.cpp
|
||||
../imgui/imgui_internal.h
|
||||
../imgui/imgui_tables.cpp
|
||||
../imgui/imgui_widgets.cpp
|
||||
../imgui/imstb_rectpack.h
|
||||
../imgui/imstb_textedit.h
|
||||
../imgui/imstb_truetype.h
|
||||
)
|
||||
add_library(imgui ${imgui_sources})
|
||||
target_include_directories(imgui PUBLIC ../imgui)
|
||||
|
||||
#
|
||||
# ImPlot library
|
||||
#
|
||||
|
||||
file(GLOB SOURCE_CODE ../implot*.*)
|
||||
add_library(implot STATIC ${SOURCE_CODE})
|
||||
|
||||
if(MSVC)
|
||||
target_compile_options(implot PRIVATE /W4 /WX)
|
||||
else()
|
||||
target_compile_options(implot PRIVATE -Wall -Werror -pedantic)
|
||||
endif()
|
||||
|
||||
target_include_directories(implot PUBLIC ${CMAKE_CURRENT_LIST_DIR}/..)
|
||||
target_link_libraries(implot PUBLIC imgui)
|
||||
|
||||
if (UNIX)
|
||||
target_link_libraries(implot PUBLIC m stdc++)
|
||||
endif()
|
||||
|
||||
# Define supported types via command line:
|
||||
# - With no choice all types are supported (so that the CI provides support for all known types)
|
||||
# - with -DIMPLOT_CUSTOM_NUMERIC_TYPES="default" the default set defined in implot_items.cpp is used
|
||||
# - with -DIMPLOT_CUSTOM_NUMERIC_TYPES="(int)(float)(double)" only int, float and double are supported
|
||||
if (NOT DEFINED IMPLOT_CUSTOM_NUMERIC_TYPES)
|
||||
set(IMPLOT_CUSTOM_NUMERIC_TYPES "all")
|
||||
endif()
|
||||
if ("${IMPLOT_CUSTOM_NUMERIC_TYPES}" STREQUAL "default")
|
||||
message("==== Compiling for default types ====")
|
||||
elseif("${IMPLOT_CUSTOM_NUMERIC_TYPES}" STREQUAL "all")
|
||||
message("==== Compiling for all types ====")
|
||||
target_compile_definitions(implot PRIVATE "IMPLOT_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)")
|
||||
else()
|
||||
message("==== Compiling for custom types: ${IMPLOT_CUSTOM_NUMERIC_TYPES} ====")
|
||||
target_compile_definitions(implot PRIVATE "IMPLOT_CUSTOM_NUMERIC_TYPES=${IMPLOT_CUSTOM_NUMERIC_TYPES}")
|
||||
endif()
|
||||
|
||||
#
|
||||
# implot example binary application (with no backend)
|
||||
#
|
||||
add_executable(example_implot example_implot.cpp)
|
||||
target_link_libraries(example_implot PRIVATE implot)
|
55
.github/example_implot.cpp
vendored
Normal file
55
.github/example_implot.cpp
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
// Sample app built with Dear ImGui and ImPlot
|
||||
// This app uses implot and imgui, but does not output to any backend! It only serves as a proof that an app can be built, linked, and run.
|
||||
|
||||
#include "imgui.h"
|
||||
#include "implot.h"
|
||||
#include "stdio.h"
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
printf("sample_implot: start\n");
|
||||
|
||||
IMGUI_CHECKVERSION();
|
||||
ImGui::CreateContext();
|
||||
ImPlot::CreateContext();
|
||||
|
||||
// Additional imgui initialization needed when no backend is present
|
||||
ImGui::GetIO().DisplaySize = ImVec2(400.f, 400.f);
|
||||
ImGui::GetIO().Fonts->Build();
|
||||
|
||||
// Render 500 frames
|
||||
for(int counter = 0; counter < 500; ++counter)
|
||||
{
|
||||
ImGui::NewFrame();
|
||||
|
||||
if (ImGui::Begin("Hello, world!"))
|
||||
{
|
||||
ImGui::Text("Hello again");
|
||||
|
||||
if (ImPlot::BeginPlot("My Plot"))
|
||||
{
|
||||
static double values[] = {1., 3., 5.};
|
||||
ImPlot::PlotLine("Values", values, 3);
|
||||
ImPlot::EndPlot();
|
||||
}
|
||||
|
||||
#ifdef IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES
|
||||
if (ImPlot::BeginPlot("My Plot (long double)"))
|
||||
{
|
||||
static long double values[] = {1., 3., 5.};
|
||||
ImPlot::PlotLine("Values", values, 3);
|
||||
ImPlot::EndPlot();
|
||||
}
|
||||
#endif
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
ImGui::Render();
|
||||
}
|
||||
|
||||
ImPlot::DestroyContext();
|
||||
ImGui::DestroyContext();
|
||||
printf("sample_implot: end\n");
|
||||
return 0;
|
||||
}
|
144
.github/workflows/build.yml
vendored
Normal file
144
.github/workflows/build.yml
vendored
Normal file
|
@ -0,0 +1,144 @@
|
|||
name: build
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
Linux:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build_type:
|
||||
- debug
|
||||
- release
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
arch:
|
||||
- x86
|
||||
- x64
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ocornut/imgui
|
||||
path: imgui
|
||||
|
||||
- name: Dependencies
|
||||
run: sudo apt-get install g++-multilib
|
||||
|
||||
- name: Configure
|
||||
run: cmake -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_C_COMPILER=${{ matrix.compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DGCC_ARCH=${{ matrix.arch }} -B cmake-build -S .github
|
||||
|
||||
- name: Build
|
||||
run: cmake --build cmake-build --parallel $(nproc)
|
||||
|
||||
- name: Run
|
||||
run: |
|
||||
file cmake-build/example_implot
|
||||
cmake-build/example_implot
|
||||
|
||||
MacOS:
|
||||
runs-on: macos-11
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build_type:
|
||||
- debug
|
||||
- release
|
||||
arch:
|
||||
- x86_64
|
||||
- arm64
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ocornut/imgui
|
||||
path: imgui
|
||||
|
||||
- name: Configure
|
||||
shell: bash
|
||||
run: cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DOSX_ARCH=${{ matrix.arch }} -B cmake-build -S .github
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: cmake --build cmake-build --parallel $(sysctl -n hw.ncpu)
|
||||
|
||||
- name: Run
|
||||
if: matrix.arch == 'x86_64' # github's CI hosts seem to be running intel and can not run ARM
|
||||
run: |
|
||||
file cmake-build/example_implot
|
||||
cmake-build/example_implot
|
||||
|
||||
Windows_MSVC:
|
||||
runs-on: windows-2022
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build_type:
|
||||
- debug
|
||||
- release
|
||||
arch:
|
||||
- Win32
|
||||
- x64
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ocornut/imgui
|
||||
path: imgui
|
||||
|
||||
- name: Configure
|
||||
shell: bash
|
||||
run: cmake -G 'Visual Studio 17 2022' -A ${{ matrix.arch }} -B cmake-build -S .github
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: cmake --build cmake-build -- -p:Configuration=${{ matrix.build_type }} -maxcpucount:$NUMBER_OF_PROCESSORS
|
||||
|
||||
- name: Run
|
||||
run: .\cmake-build\${{matrix.build_type}}\example_implot.exe
|
||||
|
||||
Windows_MingW: # MingW on Github CI does not fully support 32 bits: link fails when it tries to link 64 bits system libraries.
|
||||
runs-on: windows-2022
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build_type:
|
||||
- debug
|
||||
- release
|
||||
arch:
|
||||
- x64
|
||||
# - Win32
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ocornut/imgui
|
||||
path: imgui
|
||||
|
||||
- name: Configure
|
||||
shell: bash
|
||||
run: cmake -G 'MinGW Makefiles' -DGCC_ARCH=${{ matrix.arch }} -B cmake-build -S .github
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: cmake --build cmake-build --parallel $NUMBER_OF_PROCESSORS
|
||||
|
||||
- name: Run (MingW)
|
||||
run: .\cmake-build\example_implot.exe
|
||||
|
80
README.md
80
README.md
|
@ -19,33 +19,35 @@ ImPlot is an immediate mode, GPU accelerated plotting library for [Dear ImGui](h
|
|||
- line plots
|
||||
- shaded plots
|
||||
- scatter plots
|
||||
- vertical/horizontal bars graphs
|
||||
- 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)
|
||||
- time formatted x-axes
|
||||
- subplots
|
||||
- time formatted x-axes (US formatted or ISO 8601)
|
||||
- reversible and lockable axes
|
||||
- up to three independent y-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)
|
||||
- remappable input controls
|
||||
- several plot styling options: 10 marker types, adjustable marker sizes, line weights, outline colors, fill colors, etc.
|
||||
- 10 built-in and user definable colormaps
|
||||
- 16 built-in colormaps and support for and user-added colormaps
|
||||
- optional plot titles, axis labels, and grid labels
|
||||
- optional legend with toggle buttons to quickly show/hide items
|
||||
- default styling based on current ImGui theme, but most elements can be customized independently
|
||||
- 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](https://github.com/epezent/implot/issues/48))
|
||||
- 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()`, `PlotErrorBars()`, etc). Finally, wrap things up with a call to `ImPlot::EndPlot()`. That's it!
|
||||
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] = ...;
|
||||
|
@ -65,12 +67,16 @@ ImGui::End();
|
|||

|
||||
|
||||
|
||||
Of course, there's much more you can do with ImPlot. Consult `implot_demo.cpp` for a comprehensive example of ImPlot's features.
|
||||
Of course, there's much more you can do with ImPlot...
|
||||
|
||||
## Interactive Demo
|
||||
## 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.
|
||||
|
@ -87,14 +93,26 @@ ImGui::DestroyContext();
|
|||
|
||||
You should be good to go!
|
||||
|
||||
If you want to test ImPlot quickly, consider trying [mahi-gui](https://github.com/mahilab/mahi-gui), which bundles ImGui, ImPlot, and several other packages for you.
|
||||
## Installing ImPlot using vcpkg
|
||||
|
||||
## Special Notes
|
||||
You can download and install ImPlot using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
|
||||
|
||||
- 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 [imgui@f6120f8](https://github.com/ocornut/imgui/commit/f6120f8e16eefcdb37b63974e6915a3dd35414be), 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;`.
|
||||
```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
|
||||
|
||||
|
@ -104,15 +122,24 @@ A: ImGui is an incredibly powerful tool for rapid prototyping and development, b
|
|||
|
||||
**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.
|
||||
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 started. Also take a look at the [implot_demos](https://github.com/epezent/implot_demos) repository.
|
||||
|
||||
**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. However, you can downsample extremely large datasets by telling ImPlot to stride your data at larger intervals if needed.
|
||||
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. Also try the experimental `backends` branch which aims to provide GPU acceleration support.
|
||||
|
||||
**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), and many plotters provide a "getter" overload which accepts data generating callbacks. You can fully customize the list of accepted types by defining `IMPLOT_CUSTOM_NUMERIC_TYPES` at compile time: see doc in `implot_items.cpp`.
|
||||
|
||||
**Q: Can plot styles be modified?**
|
||||
|
||||
A: Yes. Plot colors, palettes, and various styling 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.
|
||||
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?**
|
||||
|
||||
|
@ -120,11 +147,11 @@ 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.
|
||||
A: Yes. Up to three x-axes and three y-axes can be enabled.
|
||||
|
||||
**Q: Does ImPlot support [insert plot type]?**
|
||||
|
||||
A: Maybe. Check the demo, gallery, or [Announcements](https://github.com/epezent/implot/issues/48) to see if your desired plot type is shown. If not, consider submitting an issue or better yet, a PR!
|
||||
A: Maybe. Check the demo, gallery, or Announcements ([2020](https://github.com/epezent/implot/issues/48)/[2021](https://github.com/epezent/implot/issues/168))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?**
|
||||
|
||||
|
@ -132,7 +159,7 @@ 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.
|
||||
A: By default, no anti-aliasing is done on line plots for performance gains. If you use at least 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;`.
|
||||
|
||||
**Q: Does ImPlot provide analytic tools?**
|
||||
|
||||
|
@ -142,11 +169,10 @@ A: Not exactly, but it does give you the ability to query plot sub-ranges, with
|
|||
|
||||
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: What date types can I plot?**
|
||||
**Q: Can I compile ImPlot as a dynamic library?**
|
||||
|
||||
A: ImPlot plotting functions accept most scalar types:
|
||||
`float`, `double`, `int8`, `uint8`, `int16`, `uint16`, `int32`, `uint32`, `int64`, `uint64`.
|
||||
A: 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 must and 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: Can ImPlot be used with other languages/bindings?**
|
||||
|
||||
A: Yes, you can use the generated C binding, [cimplot](https://github.com/cimgui/cimplot) with most high level languages. [DearPyGui](https://github.com/hoffstadt/DearPyGui) provides a Python wrapper, among other things. A Rust binding, [implot-rs](https://github.com/4bb4/implot-rs), is currently in the works. An example using Emscripten can be found [here](https://github.com/pthom/implot_demo).
|
||||
A: Yes, you can use the generated C binding, [cimplot](https://github.com/cimgui/cimplot) with most high level languages. [DearPyGui](https://github.com/hoffstadt/DearPyGui) provides a Python wrapper, among other things. [imgui-java](https://github.com/SpaiR/imgui-java) provides bindings for Java. A Rust binding, [implot-rs](https://github.com/4bb4/implot-rs), is currently in the works. An example using Emscripten can be found [here](https://github.com/pthom/implot_demo).
|
||||
|
|
100
TODO.md
Normal file
100
TODO.md
Normal file
|
@ -0,0 +1,100 @@
|
|||
The list below represents a combination of high-priority work, nice-to-have features, and random ideas. We make no guarantees that all of this work will be completed or even started. If you see something that you need or would like to have, let us know, or better yet consider submitting a PR for the feature.
|
||||
|
||||
## API
|
||||
|
||||
## Axes
|
||||
|
||||
- add flag to remove weekends on Time axis
|
||||
- pixel space scale (`ImPlotTransform_Display`), normalized space scale (`ImPlotTransform_Axes`), data space scale (`ImPlotTransform_Data`)
|
||||
- make ImPlotFlags_Equal not a flag -> `SetupEqual(ImPlotAxis x, ImPlotAxis y)`
|
||||
- allow inverted arguments `SetAxes` to transpose data?
|
||||
- `SetupAxisColors()`
|
||||
- `SetupAxisHome()`
|
||||
|
||||
## Plot Items
|
||||
|
||||
- add `PlotBubbles` (see MATLAB bubble chart)
|
||||
- add non-zero references for `PlotBars` etc.
|
||||
- add exploding to `PlotPieChart` (on hover-highlight?)
|
||||
- fix appearance of `PlotBars` spacing
|
||||
|
||||
## Styling
|
||||
|
||||
- support gradient and/or colormap sampled fills (e.g. ImPlotFillStyle_)
|
||||
- API for setting different fonts for plot elements
|
||||
|
||||
## Colormaps
|
||||
|
||||
- gradient editing tool
|
||||
- `RemoveColormap`
|
||||
- `enum ImPlotColorRule_ { Solid, Faded, XValue, YValue, ZValue }`
|
||||
|
||||
## Legend
|
||||
|
||||
- `ImPlotLegendFlags_Scroll`
|
||||
- improve legend icons (e.g. adopt markers, gradients, etc)
|
||||
- make legend frame use ButtonBehavior (maybe impossible)
|
||||
|
||||
## Tools / Misc.
|
||||
|
||||
- add `IsPlotChanging` to detect change in limits
|
||||
- add ability to extend plot/axis context menus
|
||||
- add LTTB downsampling for lines
|
||||
- add box selection to axes
|
||||
- first frame render delay might fix "fit pop" effect
|
||||
- move some code to new `implot_tools.cpp`
|
||||
- ColormapSlider (see metrics)
|
||||
- FillAlpha should not affect markers?
|
||||
- fix mouse text for time axes
|
||||
|
||||
## Optimizations
|
||||
|
||||
- find faster way to buffer data into ImDrawList (very slow)
|
||||
- reduce number of calls to `PushClipRect`
|
||||
- explore SIMD operations for high density plot items
|
||||
|
||||
## Plotter Pipeline
|
||||
|
||||
Ideally every `PlotX` function should use our faster rendering pipeline when it is applicable.
|
||||
|
||||
` User Data > Getter > Fitter > Renderer > RenderPrimitives`
|
||||
|
||||
|Plotter|Getter|Fitter|Renderer|RenderPrimitives|
|
||||
|---|:-:|:-:|:-:|:-:|
|
||||
|PlotLine|Yes|Yes|Yes|Yes|
|
||||
|PlotScatter|Yes|Yes|Yes|Yes|
|
||||
|PlotStairs|Yes|Yes|Yes|Yes|
|
||||
|PlotShaded|Yes|Yes|Yes|Yes|
|
||||
|PlotBars|Yes|Yes|Yes|Yes|
|
||||
|PlotBarGroups|:|:|:|:|
|
||||
|PlotHistogram|:|:|:|:|
|
||||
|PlotErrorBars|Yes|Yes|No|No|
|
||||
|PlotStems|Yes|Yes|Yes|Yes|
|
||||
|PlotInfLines|Yes|Yes|Yes|Yes|
|
||||
|PlotPieChart|No|No|No|No|
|
||||
|PlotHeatmap|Yes|No|Yes|Mixed|
|
||||
|PlotHistogram2D|:|:|:|:|
|
||||
|PlotDigital|Yes|No|No|No|
|
||||
|PlotImage|-|-|-|-|
|
||||
|PlotText|-|-|-|-|
|
||||
|PlotDummy|-|-|-|-|
|
||||
|
||||
## Completed
|
||||
- make BeginPlot take fewer args:
|
||||
- make query a tool -> `DragRect`
|
||||
- rework DragLine/Point to use ButtonBehavior
|
||||
- add support for multiple x-axes and don't limit count to 3
|
||||
- make axis side configurable (top/left, right/bottom) via new flag `ImPlotAxisFlags_Opposite`
|
||||
- add support for setting tick label strings via callback
|
||||
- give each axis an ID, remove ad-hoc DND solution
|
||||
- allow axis to be drag to opposite side (ala ImGui Table headers)
|
||||
- legend items can be hovered even if plot is not
|
||||
- fix frame delay on DragX tools
|
||||
- remove tag from drag line/point -> add `Tag` tool
|
||||
- add shortcut/legacy overloads for BeginPlot
|
||||
- `SetupAxisConstraints()`
|
||||
- `SetupAxisScale()`
|
||||
- add `ImPlotLineFlags`, `ImPlotBarsFlags`, etc. for each plot type
|
||||
- add `PlotBarGroups` wrapper that makes rendering groups of bars easier, with stacked bar support
|
||||
- `PlotBars` restore outlines
|
||||
- add hover/active color for plot axes
|
5991
implot.cpp
5991
implot.cpp
File diff suppressed because it is too large
Load Diff
3507
implot_demo.cpp
3507
implot_demo.cpp
File diff suppressed because it is too large
Load Diff
1516
implot_internal.h
1516
implot_internal.h
File diff suppressed because it is too large
Load Diff
3401
implot_items.cpp
3401
implot_items.cpp
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user