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
Looks like pcolor() does the same, and has basically always done so.
It's probably actually not too hard to change that (and I think removing that line makes sense): one can check before the call to grid(False) whether the grid is on (which would only happen if explicitly set earlier in the code and then the user relying on pcolor(mesh)() unsetting it...) and if so emit a deprecationwarning asking to unset the grid first.
Could it be that this serves the purpose of overriding rcParams[axes.grid.*] settings for these plots? By default, a style might have grid lines, but they don't make sense for false-color plots.
Could it be that this serves the purpose of overriding rcParams[axes.grid.*] settings for these plots? By default, a style might have grid lines, but they don't make sense for false-color plots.
Actually I occasionally do want grids on my images.
As a suggestion, maybe add another rcParams['axes.auto_disable'] ?
In that case I would suggest just disabling the grid yourself with grid(False) (or modifying the style to unset rcParams["axes.grid.*"]); I don't think every possible arrangement needs to be doable via rcParams.
Actually I occasionally do want grids on my images.
Agreed.
I don't think every possible arrangement needs to be doable via rcParams.
Agreed.
However, we need the possibility to have a style with gridded regular axes, but no grids on false-color plots. That's a reasonable combination of defaults. Moreover, that's how current styles are rendered, and we cannot request ggplot-style or seaborn-style users to add grid(False) to all their false-color plots manually.
Since an Axes does not know it will be filled with a false-color plot at creation time, I don't think there is a way around calling grid(False) within pcolormesh and similar. The only question is if it's called unconditionally, or if we add kwargs and/or rcParams to control it.
My point is that this can actually be changed with a proper deprecation transition (check whether the grid was set, and if so, warn that pcolormesh won't unset it for you anymore in the future).
I don’t think any individual artists should set axes properties.
It's the pcolormesh() method, not the artist. There's other precedence, e.g. imshow sets the aspect. I believe that some plotting functions may modify the axes by default to adapt it to the intention of the plot type.
Reacted by Jody Klymak, Harshal Prakash Patankar (pharshalp) and Till Stensitzki
Activity
ImportanceOfBeingErnest commentedon Nov 4, 2019
The grid seems to be turned off deliberately
matplotlib/lib/matplotlib/axes/_axes.py
Line 6173 in 014aa5b
I don't know if there is any specific reason for that?
jklymak commentedon Nov 4, 2019
Weird. It’s been like that for 14 years though, so may be hard to change?
anntzer commentedon Nov 4, 2019
Looks like pcolor() does the same, and has basically always done so.
It's probably actually not too hard to change that (and I think removing that line makes sense): one can check before the call to
grid(False)whether the grid is on (which would only happen if explicitly set earlier in the code and then the user relying on pcolor(mesh)() unsetting it...) and if so emit a deprecationwarning asking to unset the grid first.timhoffm commentedon Nov 4, 2019
Could it be that this serves the purpose of overriding
rcParams[axes.grid.*]settings for these plots? By default, a style might have grid lines, but they don't make sense for false-color plots.Anyway should
imshow()have the same behavior?Tillsten commentedon Nov 5, 2019
As a suggestion, maybe add another
rcParams['axes.auto_disable']?anntzer commentedon Nov 5, 2019
Actually I occasionally do want grids on my images.
In that case I would suggest just disabling the grid yourself with
grid(False)(or modifying the style to unsetrcParams["axes.grid.*"]); I don't think every possible arrangement needs to be doable via rcParams.timhoffm commentedon Nov 5, 2019
Agreed.
Agreed.
However, we need the possibility to have a style with gridded regular axes, but no grids on false-color plots. That's a reasonable combination of defaults. Moreover, that's how current styles are rendered, and we cannot request ggplot-style or seaborn-style users to add
grid(False)to all their false-color plots manually.Since an Axes does not know it will be filled with a false-color plot at creation time, I don't think there is a way around calling
grid(False)withinpcolormeshand similar. The only question is if it's called unconditionally, or if we add kwargs and/or rcParams to control it.anntzer commentedon Nov 5, 2019
If we're going to make the user add a kwarg to each call I don't see how that's better than requesting that the user calls grid(False) first.
Also note that imshow() doesn't have that behavior, even though it's arguably in the same category of plots.
jklymak commentedon Nov 5, 2019
I don’t think any individual artists should set axes properties. If it weren’t for back compatibility concerns I’d vote to change this
timhoffm commentedon Nov 5, 2019
For backward compatibility, the default would of course stay to deactivate the grid.
anntzer commentedon Nov 5, 2019
My point is that this can actually be changed with a proper deprecation transition (check whether the grid was set, and if so, warn that pcolormesh won't unset it for you anymore in the future).
timhoffm commentedon Nov 5, 2019
It's the
pcolormesh()method, not the artist. There's other precedence, e.g.imshowsets the aspect. I believe that some plotting functions may modify the axes by default to adapt it to the intention of the plot type.