-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subplots #203
Conversation
new signature ID, ImPool to store padding data, demo
vertical will align Y axis, horizontal will align X axis. *signature changed
Two things that come to mind:
|
Some things also, (they might be a bit pedantic)
|
One thing that would be super useful for my application is the ability to resize the rows and columns. I currently achieve this in my app by using an invisible button between the plots as demonstrated here. This currently works "okay" but i have the issue of time alignment if the y ticks change width on one of the plots which this branch aims so solve: EDIT: Simply using |
This looks amazing! Can the split locations be read / initialized? (I have an application where we need to persist the user-edited layout across application restarts). |
Yes, that's what I'm planning. It's not currently implemented in full, but: IMPLOT_API bool BeginSubplots(const char* title_id,
int rows,
int cols,
const ImVec2& size,
ImPlotSubplotFlags flags = ImPlotSubplotFlags_None,
float* row_sizes = NULL,
float* col_sizes = NULL); You can set row and col sizes by passing arrays as optional args. These are percentages of total plot width/height, so each array sums to 1. If the user manipulates the splitters, these arrays will be updated and returned as an out paramter. |
…ap in BeginSubplots(). (epezent#203) Likely this was pulled from SplitterBehavior(), where it made senses but only given the possibility user would call SetItemAllowOverlap() after. AFAIK after debugging the code I _think_ this has no meaningful side-effect. Also removed same thing in Tables code in core lib. Flag added in epezent@4a1ee88.
…ap in BeginSubplots(). (#203) Likely this was pulled from SplitterBehavior(), where it made senses but only given the possibility user would call SetItemAllowOverlap() after. AFAIK after debugging the code I _think_ this has no meaningful side-effect. Also removed same thing in Tables code in core lib. Flag added in 4a1ee88.
…ap in BeginSubplots(). (epezent#203) Likely this was pulled from SplitterBehavior(), where it made senses but only given the possibility user would call SetItemAllowOverlap() after. AFAIK after debugging the code I _think_ this has no meaningful side-effect. Also removed same thing in Tables code in core lib. Flag added in epezent@4a1ee88.
* SubPlots: Y axis padding over multiple plots * Align Plots Group new signature ID, ImPool to store padding data, demo * Align plots orientation (vertically, horizontally) vertical will align Y axis, horizontal will align X axis. *signature changed * ImPlotOrientation used as flag for 2D grids of aligned plots epezent#144 (comment) * AlignPlots updates to merge with v.0.9 * Sync to v0.9 20210127 * subplots proto * make link flags work * stuff * add multi-line centered titles * subplots work * flag ideas * better subplot positioning * resizable subplots * subplot shared items * subplot ratios * some cleanup and refactor * some cleanup and refactor * refactors and demo reorganization * context menus...almost done! * context menus, bug fixes * active id * make implot use ButtonBehavior throughout * bug fixes * more bug fixes * tweaks * fix id issue * finish work on subplots Co-authored-by: ozlb <ozlb@users.noreply.github.com>
…ap in BeginSubplots(). (epezent#203) Likely this was pulled from SplitterBehavior(), where it made senses but only given the possibility user would call SetItemAllowOverlap() after. AFAIK after debugging the code I _think_ this has no meaningful side-effect. Also removed same thing in Tables code in core lib. Flag added in epezent@4a1ee88.
This PR extends the work of @ozlb's aligned plots #144. It adds a new API for creating both 1D and 2D sublots with automatic alignment along rows and columns. I expect this PR to be a WIP for a few weeks, as I want to make subplots a first-class feature and I have several
ImPlotSubplotFlags_
options in mind for them.Looping in interested parties and regulars: @yaman, @peterwilson136, @Mrgoodbytes13, @arximboldi, @ocornut, @bear24rw, @jvannugteren, @mindv0rtex, @PeterJohnson, @hoffstadt
What features would you like to see in a subplot API? How could this be more useful than plots inside of ImGui tables?
Current API prototype (feel free to try, but very rough at the moment). Usage is a simple a matter of surrounding
rows
*cols
calls toBegin/EndPlot
inside ofBegin/EndSubplot
. Plots are arranged in row-major order. Currently it is not possible to plot out of order (and I don't see an easy path forward for that). IDs are handled behind the scenes, so no need to Push/Pop IDs or use different titles. TheImVe2 size
parameter of BeginPlot is ignored when inside of a Subplot context, as the size is determind from the parameter passed toBeginSubplot
. Otherwise, everything else is the same as usingBeginPlot
.