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 zorder (grid, scatter, line, etc) in rcParams #29699
I'm working on rcParams and I'd really like it to be possible to control the default zorder of certain elements. The more the better, but being able to control the zorder specifically for grid, lines, scatter and bars would be great!
Is that possible?
Also, I'm willing to open a PR for this as long as it doesn't require a deep understanding of the inner workings of matplotlib.
So might be worth thinking of this from that broader picture given that as far as I can see, this proposal would entail adding zorder to a bunch of properties (lines.zorder, etc)/
@story645 Would such a PR be welcome in the current rcParams structure, or should I wait until the spec changes are more finalized?
If it helps, from the user's point of view, rcParams is really intuitive and I don't know what other specifications would add. The only thing that I feel could be improved is the matplotlibrc file, which I've always found confusing.
We have been relatively permissive about adding new rcparams when there has been a use case (we grow one or two per release). I suspect we would merge a PR adding the 4 listed zorder controls.
The majortick zorder is currently line.zorder + 0.01. We could leave that for a start, or also think about making it configureable. Same with grid.zorder.
how? what kinda things would make it easier for you?
It's more than that I don't understand why users should even be aware of this file. When looking at this in the documentation, it suggests that we can modify values in it to customize a plot, but at the same time the top of the file is ## NOTE FOR END USERS: DO NOT EDIT THIS FILE!
From what I understand, rcParams is the only thing that users should be worried about, both in terms of ease of use and reproductibility (since I assume the matplotlibrc file is not meant to be versioned).
Maybe this documentation is meant for matplotlib developers, but it's not obvious.
What I like about this page in the documentation is that it contains all the rcParams parameters clearly defined.
Just a user here, I recently wanted to put the gridlines behind the plot (I strongly feel this should be the default option!) but failed to do so. Online search leads to this popular stackoverflow post which suggests plt.rc('axes', axisbelow=True) which doesn't work anymore.
So, having an option to control the zorder of the grid via rcParams would be great!
Activity
JosephBARBIERDARNAL commentedon Mar 3, 2025
Note: more generally, I have a list of other things I'd like to see in rcParams.
story645 commentedon May 7, 2025
@JosephBARBIERDARNAL one of the things we've been discussing on and off is what our rcparams spec should even be - should it migrate to Python or json or the like (a good proportion of https://matplotlib.org/devdocs/devel/MEP/index.html)
So might be worth thinking of this from that broader picture given that as far as I can see, this proposal would entail adding zorder to a bunch of properties (lines.zorder, etc)/
JosephBARBIERDARNAL commentedon May 9, 2025
@story645 Would such a PR be welcome in the current rcParams structure, or should I wait until the spec changes are more finalized?
If it helps, from the user's point of view, rcParams is really intuitive and I don't know what other specifications would add. The only thing that I feel could be improved is the matplotlibrc file, which I've always found confusing.
tacaswell commentedon May 9, 2025
We have been relatively permissive about adding new rcparams when there has been a use case (we grow one or two per release). I suspect we would merge a PR adding the 4 listed zorder controls.
JosephBARBIERDARNAL commentedon May 9, 2025
Great! Any pointers on how to add something to rcParams would be much appreciated (a PR that does this might actually work, I'll try to find one).
tacaswell commentedon May 9, 2025
#18715 is a reasonable template.
JosephBARBIERDARNAL commentedon May 9, 2025
Perfect, thanks
story645 commentedon May 9, 2025
how? what kinda things would make it easier for you?
timhoffm commentedon May 9, 2025
The current zorder values are collected here: https://matplotlib.org/stable/gallery/misc/zorder_demo.html#zorder-demo.
If we start making them configurable, we should do all
The majortick zorder is currently line.zorder + 0.01. We could leave that for a start, or also think about making it configureable. Same with grid.zorder.
JosephBARBIERDARNAL commentedon May 10, 2025
It's more than that I don't understand why users should even be aware of this file. When looking at this in the documentation, it suggests that we can modify values in it to customize a plot, but at the same time the top of the file is
## NOTE FOR END USERS: DO NOT EDIT THIS FILE!From what I understand, rcParams is the only thing that users should be worried about, both in terms of ease of use and reproductibility (since I assume the matplotlibrc file is not meant to be versioned).
Maybe this documentation is meant for matplotlib developers, but it's not obvious.
What I like about this page in the documentation is that it contains all the rcParams parameters clearly defined.
rcomer commentedon May 10, 2025
The following lines state that users should make a copy of the file and edit that. Is there a way you think we could make that more obvious?
JosephBARBIERDARNAL commentedon May 10, 2025
I just realised I'd misread it, I thought it was
NOTinstead ofNOTE.But maybe something like that would be more intuitive:
## DO NOT EDIT THIS FILE, MAKE A COPY FIRSTstory645 commentedon May 11, 2025
Wanna open that PR?
JosephBARBIERDARNAL commentedon May 11, 2025
Yes, here it is: #30037
pamitabh commentedon Dec 18, 2025
Just a user here, I recently wanted to put the gridlines behind the plot (I strongly feel this should be the default option!) but failed to do so. Online search leads to this popular stackoverflow post which suggests
plt.rc('axes', axisbelow=True)which doesn't work anymore.So, having an option to control the zorder of the grid via rcParams would be great!