You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[ENH]: Add dark mode for subplot configuration tool #27592
The subplot configuration tool is currently white background/black text when macOS is in dark mode. It would be nice to apply a dark style sheet when macOS is in dark mode. This is using the macosx backend, but might be an issue for other backends (but not QT AFAIK).
A fundamentally reasonable request. But this applies also to other OS.
Questions that come to my mind:
How do we detect this? platform-specific/cross-platform?
Can we inject this into the code path for showing the subplot configuration tool? - It intentionally uses a plot, so that we don't have to implement / maintain this across all backends. So the code path may be platform/backend-agnostic.
If we start fiddling with these things, wouldn't it be simpler to (optionally) create native GUI-toolkit versions of the dialog. If the GUI toolkit doesn't provide a the dialog, we fall back to the current figure-based dialog. I anticipate that a native version of this would only be a handful of lines of code, and I don't expect the dialog to change a lot, so the maintainance burden is bearable.
I have a native version of this working. I was focused on keyboard accessibility, but we get dark mode as well:
The main question is the ordering of the sliders. qtagg's native tool uses an order of "top", "bottom", "left", "right" / "hspace", "wspace":
The figure-based approach uses an order of "left", "bottom", "right", "top", "wspace", "hspace", which matches the positional ordering in matplotlib.pyplot.subplots_adjust:
Starting at left and then proceeding anti-clockwise has never made sense to my brain.
Pairing up top/bottom, left/right, wspace/hspace makes more sense to me. Alternatively: (left,top,right,bottom) would match (x0/y0/x1/y1) found in some UI frameworks. (top,right,bottom,left) matches CSS ordering for shorthand syntax. To me, placing 'wspace' first makes sense if 'left' is first; 'hspace' first if 'top' is first.
I'm inclined to match the qtagg ordering, but I'm not sure if others have strong opinions on this.
The order left/bottom/right/top is actually x0/y0/x1/y1 since our figure and Axes coordinate systems start at the bottom left. This is the order of the boundary points in Bbox.
So formally, this makes sens, but I'm also stumbling over this.
The point is that this is designed conceptually more as box parameters i.e. absolute coordinates, and not so much as margins. This also means you have left=0.1; right=0.9 for equal margins. Therefore the CSS analogy and order are unfortunately not really applicable (I would have found margins more useful, in particular also because wspace, hspace are distances - but we are not there).
Overall, I don't have a strong opinion. Either order is fine for me. - And we could even switch later.
Activity
timhoffm commentedon Jan 1, 2024
A fundamentally reasonable request. But this applies also to other OS.
Questions that come to my mind:
jklymak commentedon Jan 1, 2024
The subplot config tool is just a figure isn't it? I guess injecting the right style sheet is a way forward?
timhoffm commentedon Jan 2, 2024
Yes. Subject to my questions above.
anntzer commentedon Jan 2, 2024
I would say a native tool (such as the one already present for the qt backend) is much more ergonomic.
iccir commentedon Jun 30, 2026
I have a native version of this working. I was focused on keyboard accessibility, but we get dark mode as well:
The main question is the ordering of the sliders. qtagg's native tool uses an order of "top", "bottom", "left", "right" / "hspace", "wspace":
The figure-based approach uses an order of "left", "bottom", "right", "top", "wspace", "hspace", which matches the positional ordering in
matplotlib.pyplot.subplots_adjust:Starting at left and then proceeding anti-clockwise has never made sense to my brain.
Pairing up top/bottom, left/right, wspace/hspace makes more sense to me. Alternatively: (left,top,right,bottom) would match (x0/y0/x1/y1) found in some UI frameworks. (top,right,bottom,left) matches CSS ordering for shorthand syntax. To me, placing 'wspace' first makes sense if 'left' is first; 'hspace' first if 'top' is first.
I'm inclined to match the qtagg ordering, but I'm not sure if others have strong opinions on this.
timhoffm commentedon Jun 30, 2026
The order left/bottom/right/top is actually x0/y0/x1/y1 since our figure and Axes coordinate systems start at the bottom left. This is the order of the boundary points in Bbox.
So formally, this makes sens, but I'm also stumbling over this.
The point is that this is designed conceptually more as box parameters i.e. absolute coordinates, and not so much as margins. This also means you have
left=0.1; right=0.9for equal margins. Therefore the CSS analogy and order are unfortunately not really applicable (I would have found margins more useful, in particular also because wspace, hspace are distances - but we are not there).Overall, I don't have a strong opinion. Either order is fine for me. - And we could even switch later.
iccir commentedon Jun 30, 2026
That probably explains why my brain always hurt when adjusting the subplot :) Truthfully, I would play with the sliders until it looked right.
I coded up the order to be a simple array so re-ordering the rows in the future will be straightforward - no layout code needed.