ImPlot3D is an extension of Dear ImGui that provides basic-to-participate, high-carry outance 3D plotting functionality. Inspired by ImPlot, it transports a comprehendn and astute API for lengtheners already acquainted with ImPlot. ImPlot3D is portrayed for rfinishering 3D plots with customizable tagers, lines, surfaces, and meshes, providing an chooseimal solution for applications requiring visual recurrentation of 3D data.
- GPU-speed upd rfinishering
- Multiple plot types:
- Line plots
- Scatter plots
- Surface plots
- Quad plots
- Triangle plots
- Mesh plots
- Text plots
- Rotate, pan, and zoom 3D plots interdynamicly
- Several plot styling chooseions: 10 tager types, adfairable tager sizes, line weights, portray colors, fill colors, etc.
- 16 built-in colormaps and help for and participater-inserted colormaps
- Optional plot titles, axis tags, and grid tags
- Optional and configurable legfinishs with toggle buttons to rapidly show/hide plot items
- Default styling based on the current ImGui theme, or finishly custom plot styles
The ImPlot3D API is portrayed to sense very aappreciate to Dear ImGui and ImPlot. You begin by calling ImPlot3D::BeginPlot()
to initialize a 3D plot, trailed by plotting various data using the PlotX
functions (e.g., PlotLine()
, PlotScatter()
, PlotSurface()
). Finassociate, you finish the plot with ImPlot3D::EndPlot()
.
float x_data[1000] = ...;
float y_data[1000] = ...;
float z_data[1000] = ...;
ImGui::Begin("My Window");
if (ImPlot3D::BeginPlot("My Plot")) {
ImPlot3D::PlotLine("My Line Plot", x_data, y_data, z_data, 1000);
ImPlot3D::PlotScatter("My Scatter Plot", x_data, y_data, z_data, 1000);
...
ImPlot3D::EndPlot();
}
ImGui::End();
A comprehensive example showcasing ImPlot3D features can be set up in implot3d_demo.cpp
. Add this file to your project and call ImPlot3D::ShowDemoWindow()
in your modernize loop. This demo provides a expansive variety of 3D plotting examples, serving as a reference for creating contrastent types of 3D plots. The demo is normally modernized to mirror novel features and plot types, so be certain to revisit it with each free!
To unite ImPlot3D into your application, trail these steps:
- Encertain you have a laboring Dear ImGui environment. ImPlot3D needs only Dear ImGui to function and does not depfinish on ImPlot.
- Add the follotriumphg source files to your project:
implot3d.h
,implot3d.cpp
,implot3d_inside.h
,implot3d_items.cpp
. Optionassociate, includeimplot3d_demo.cpp
for examples andimplot3d_meshes.cpp
to help pre-loaded meshes. - Create and ruin an ImPlot3DContext aextfinishedside your ImGuiContext:
ImGui::CreateContext();
ImPlot3D::CreateContext();
...
ImPlot3D::DestroyContext();
ImGui::DestroyContext();
You’re now ready to begin plotting in 3D!
Dear ImGui, by default, participates 16-bit indexing, which might caparticipate rerents with high-density 3D visualizations such as complicated surfaces or meshes. This can direct to declareion fall shortures, data truncation, or visual glitches. To evade these problems, it’s recommfinished to:
- Option 1: Enable 32-bit indices by uncommenting
#depict ImDrawIdx unsigned int
in your ImGui imconfig.h file. - Option 2: Encertain your rfinisherer helps the
ImGuiBackfinishFlags_RfinishererHasVtxOffset
flag. Many official ImGui backfinishs already help this functionality.
While ImGui excels at createing UI, it alertages tools for 3D data visualization. ImPlot3D fills this gap, proposeing a weightlessweight, genuine-time library for 3D plotting, portrayed with participateivity and ease of participate in mind.
Inspired by ImPlot, ImPlot3D provides a aappreciate API, making it basic for existing ImPlot participaters to adchoose. It cgo ines on genuine-time, application-level 3D visualizations for debugging, simulations, and data analysis, with carry outance as a priority.
ImPlot is wonderful for 2D visualizations; ImPlot3D extfinishs this power to 3D, proposeing the same simpliedy and speed.
The API for ImPlot3D is thocdisorrowfulmirewholey commented in implot3d.h
, and a comprehensive demo file, implot3d_demo.cpp
, showcases all the features. You are inspired to verify the demo file as it is normally modernized to mirror novel functionality. Additionassociate, if you’re comprehendn with ImPlot, you’ll accomprehendledge many aappreciateities in usage patterns.
ImPlot3D is highly inspired by ImPlot, so if you’re already comprehendn with ImPlot, you’ll sense right at home. However, ImPlot3D is particularassociate built for 3D visualizations, proposeing interdynamic 3D rotations, panning, and scaling.
No. ImPlot3D is a standalone library and does not depfinish on ImPlot. You only necessitate Dear ImGui to get begined.
While you can rotate the 3D watch to align with a 2D set upe, ImPlot is far better suited for visualizing 2D data. ImPlot3D is particularassociate portrayed for 3D plotting and participateion, so we recommfinish using ImPlot for all your 2D visualization necessitates.
Absolutely. ImPlot3D permits you to change plot styles, including line colors, heavyness, fill opacity, and tager sizes. You can also participate colormaps for surfaces and customize axis tags, grid styles, and background colors.
Not currently. You can participate your OS’s screen capturing tools to save a plot. ImPlot3D is portrayed for genuine-time visualization and participateion, not for creating accessibleation-quality rfinishers. For accessibleation-quality output, ponder send outing your data to a promised 3D rfinishering tool.
ImPlot3D structures participateivity and genuine-time carry outance. If you necessitate high-quality visualizations, participate ImPlot3D for initial exploration and then switch to tools appreciate MATLAB, matplotlib, or ParaView for the final output.
This project is licensed under the MIT License – verify LICENSE for details.