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
In Matplotlib Version 3.7.0, setting axes.labelsize via a mplstyle file or by updating rcParams does not change the font size of xlabel and ylabel.
Code for reproduction
importmatplotlib.pyplotaspltsize=24plt.style.use("default")
plt.rcParams.update(
{
"axes.labelsize": size, # has no effect"axes.titlesize": size, # works as expected"xtick.labelsize": size, # works as expected"ytick.labelsize": size, # works as expected
}
)
fig, ax=plt.subplots(constrained_layout=True)
ax.plot([0, 1], [0, 1])
ax.set(title="Title", xlabel="x-label", ylabel="y-label")
plt.show()
Actual outcome
Expected outcome
I would expect the xlabel and ylabel to have font size 24 (same as the tick-labels and the title).
Additional information
The issue seems to only occur in Matplotlib Version 3.7.0 (installed from conda-forge). When downgrading to Version 3.6.2, everything works expected. Here is a minimal conda-environment to reproduce the issue:
# env.yml -- install via "conda env create -f env.yml"
name: minimal_example
channels:
- conda-forge
dependencies:
- python=3.10
# - matplotlib=3.6.2 # works
- matplotlib=3.7.0 # does not work
In either case, setting the xlabel size directly via plt.xlabel("x-label", size=24) or via ax.set_xlabel("x-label", size=24) works as expected.
Activity
rcomer commentedon Feb 23, 2023
Thanks for the clear report @urob. I have reproduced this, and agree we seem to have broken this at v3.7.
rcomer commentedon Feb 23, 2023
Bisects to #21253.
rcomer commentedon Feb 23, 2023
But actually is already fixed by #25237.