Expose `ImPlot::SetAxes()` to allow explicit X/Y axis pairing for plot series

Open
#2,620 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp, python
Domain
api, desktop

Research direction

Start by locating the existing dpg.add_plot_axis() and dpg.add_line_series() entry points and the ImPlot::SetAxes() call described in the issue. Compare the proposed set_plot_axes() method with optional series parameters, while preserving current rank-based behavior. Done means a series can explicitly select X and Y axes and existing users retain the default behavior.

Written by the indexing model from the issue text.

Description

state: pending type: improvement

Description

Currently in DearPyGui, series can be added as children of any of the following axes — mvXAxis, mvXAxis2, mvXAxis3, mvYAxis, mvYAxis2, mvYAxis3 — but there is no way to explicitly control the pairing between X and Y axes for a given series.

It is not entirely clear to how DPG assigns axis pairings when multiple axes exist - the behavior appears inconsistent depending on which order the axes were created using dpg.add_plot_axis(), and what the hide/show state is when assigning via dpg.add_line_series(), etc.

It appears that the ImPlot API has supported explicit axis pairing since v0.13 via ImPlot::SetAxes(ImAxis x_idx, ImAxis y_idx), called immediately before each plot call. This is not currently exposed in DPG.

Proposed API

Expose this as an additional DPG method while leaving current default rank-based behavior intact. Users who do not call it get existing behavior. Users who need explicit control can override it:

dpg.set_plot_axes(series_tag, x_axis=dpg.mvXAxis2, y_axis=dpg.mvYAxis1)

Or as optional parameters on series add functions:

dpg.add_line_series(..., x_axis=dpg.mvXAxis2, y_axis=dpg.mvYAxis1)

Use Case

I'm building a multi-axis time series viewer where users drag and drop data columns onto specific axes. With explicit axis pairing exposed, when a user drags a series onto a specific axis I can detect how many alternative axes are currently enabled/visible and prompt the user to select the destination pairing — for example, drag onto Y2 and get a popup asking whether to plot against X1, X2, or X3. This is currently impossible because the pairing is assigned automatically with no way to override it after the fact.

Workarounds
I have not found reliable workarounds for the default behavior

Dominant language
C++
Stars
15.7k
Forks
790
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hoffstadt/DearPyGui

All issues in hoffstadt/DearPyGui

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.