-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed as duplicate of#27608
Closed as duplicate of#27608
Copy link
Description
Bug summary
When using set_title(), the size (or fontsize) argument will be ignored if using a custom font, e.g. a FontProperties object.
Code for reproduction
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
# assumes Roboto is installed, but works with any family
font = FontProperties(family="Roboto")
fontsize = 30
def left_chart(ax):
ax.set_title("hey", size=fontsize, font=font)
ax.text(x=0.2, y=0.5, s="not", size=fontsize, font=font)
def right_chart(ax):
ax.set_title("hey", size=fontsize)
ax.text(x=0.2, y=0.5, s="not", size=fontsize)
fig, axs = plt.subplots(ncols=2)
left_chart(axs[0])
right_chart(axs[1])Actual outcome
Expected outcome
Additional information
- I do not observe this behavior with other props (color, etc)
- My issue mentions
set_title()because this is how I found out about this behavior and I couldn't reproduce it with justtext(), but the root cause might not come fromset_title().
Operating system
OS/X
Matplotlib Version
3.10.7
Matplotlib Backend
module://positron.matplotlib_backend
Python version
3.13.1
Jupyter version
/
Installation
pip
Metadata
Metadata
Assignees
Labels
No labels