Resolve "Let PlotHelper support multiple axes"
What does this MR do?
This MR makes the PlotHelper
class work axis-specific. That means:
- The behaviour when using a figure with a single axis is still the same:
- When a helper is invoked, it only works on the currently selected axis (as before)
- All other interface functions refer only to the currently selected axis
- It is now, however, possible to setup a new figure with
ncols
andnrows
specifying the subplots- When invoking
setup_figure
dynamically, the existing figure is discarded and a new figure is created.- This no longer throws an error. I saw no other way of doing this, as it should be possible to do this dynamically.
- Given the basic configuration (passed to
__init__
), an axis-specific configuration is created. - The
cfg
property was replaced by theaxis_cfg
property, which holds the configuration for the currently selected axis
- When invoking
- All interface functions still only operate on the currently selected axis by default
- ... however, it is now possible to specify an
axes
argument to all interface functions, which makes it possible to specify which axes to apply the changes to or which axes to invoke helpers on.- The
axes
argument is actually a "match" argument, i.e.: it can contain wildcards and negative numbers. - Say we have a
(3, 4)
-shaped subplots figure-
'all'
matches all axes -
(0, 1)
matches the axis in the first column and the second row -
(Ellipsis, 0)
matches all axes in the first row -
(0, Ellipsis)
matches all axes in the first column -
(Ellipsis, Ellipsis)
matches all axes -
(-1, -1)
matches the bottom right hand corner axis
-
- To make specification via yaml easier,
None
s are converted toEllipsis
(as is also done in Pythonslice
objects)
- The
- With
select_axis
, a new axis can be selected.
Can this MR be accepted?
-
Made the PlotHelper
work axis-specific -
Tests added or adjusted -
Full test coverage -
Pipeline passes -
Changelog entry added -
Version bumped -
Approved by @jeremiastraub (if he has time)
Anything to double-check?
Does the approach make sense?
Related issues/MRs
Closes #68 (closed)
Required in utopia!289 (merged)
Edited by Utopia Developers