#28124·matplotlib

[Bug]: can not set ylabel fontsize in host_subplot

Author: BHM-BobCreated Apr 23, 2024Updated Sep 23, 2026
Labelsstatus: confirmed bugtopic: mpl_toolkittopic: ticks axis labels

Bug summary

can not set ylabel fontsize in host_subplot with ax.set_ylabel matplotlib==3.7.5

Code for reproduction

python
import matplotlib.pyplot as plt
from mpl_toolkits import axisartist
from mpl_toolkits.axes_grid1.parasite_axes import host_subplot

# normal plot
fig, ax1 = plt.subplots(figsize = (10, 8))
ax1.bar([1, 2, 3], [1, 2, 3], color = 'black')
ax1.set_ylabel('ylabel', fontsize = 20)
plt.suptitle('subplots fontsize=20', fontsize = 20)
plt.title('subplots fontsize=10', fontsize = 10)
plt.show()

# host_subplot
ax2 = host_subplot(111, axes_class=axisartist.Axes)
ax2.figure.set_size_inches((10, 8))
ax2.bar([1, 2, 3], [1, 2, 3], color = 'black')
ax2.set_ylabel('ylabel', fontsize = 20) # this code does not work
# ax2.axis['left'].label.set_fontsize(20) # this code works
plt.suptitle('host_subplot fontsize=20', fontsize = 20)
plt.title('host_subplot fontsize=10', fontsize = 10)
plt.show()

Actual outcome

ax2 has ylabel and it's font size is NOT 20 as ax1

Expected outcome

ax2 has ylabel and it's font size is 20 as ax1

Additional information

python
ax2.set_ylabel('ylabel', fontsize = 20) # this code does not work
# ax2.axis['left'].label.set_fontsize(20) # this code works

Operating system

windows10

Matplotlib Version

3.7.5

Matplotlib Backend

TkAgg

Python version

Python 3.8.10

Jupyter version

No response

Installation

pip