Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Description
Bug summary
When a figure is plotted with a bold/dark title or legend, e.g.:

Plot The title appears correctly (bold, dark).
But when the user edits any label/title from the interactive Matplotlib plotting window, such as:
- Editing xlabel
- Editing ylabel
- Editing legend text
- Changing marker properties
example:

→ the title formatting immediately resets, e.g.:
- Bold becomes normal
- Color lightens or resets
- Weight lost
example: like

This is unexpected and interrupts the workflow.
Code for reproduction
importnumpyasnpimportmatplotlib.pyplotaspltfrommatplotlib.tickerimportMultipleLocator# Define the x rangex=np.linspace(-2,2,1000)# Define the wave packet: high-frequency sine modulated by a Gaussian envelopey=np.sin(50*x)*np.exp(-x**2)#Plotting information# Create 3 subplots (3 rows, 1 column)fig,ax=plt.subplots(figsize=(9,7))# Adjust figure size if needed# Customize tick parameters for bold textax.tick_params(axis='both',direction='in',which='both')ax.tick_params(which='both',width=2)ax.tick_params(which='major',length=7,color='r')ax.tick_params(which='minor',length=4)ax.minorticks_on()# Turn on minor ticks# Set bold tick labels in Times New Romanax.tick_params(axis='x',labelsize=12)ax.tick_params(axis='y',labelsize=12)forlabelinax.get_xticklabels()+ax.get_yticklabels():label.set_fontweight('bold')label.set_fontname("Times New Roman")label.set_fontsize(20)# Set X-axis tick spacing (step size = 2)ax.xaxis.set_major_locator(MultipleLocator(2))# Define font settingsfont_settings= {"fontname":"Times New Roman","fontsize":20,# Change this for font size"fontweight":"bold"}# Labeling axes and titleax.plot(x,y,label='Group Wave',color='blue')ax.set_xlabel('Wave packet length',**font_settings)ax.set_title('High-Frequency Group Wave Packet',**font_settings)ax.set_ylabel('Amplitude',**font_settings)ax.legend(prop={'family':'Times New Roman','weight':'bold','size':12})ax.grid(True,linestyle="--",linewidth=0.5)#plt.savefig('wave packet ')plt.grid(True)plt.show()
Actual outcome
Title loses bold/dark formatting.
Text properties revert to default settings.

Expected outcome
Title and other text properties should remain intact.
Editing a label should NOT modify unrelated elements.

Additional information
This problem interrupt the workflow....
Operating system
Windows
Matplotlib Version
Matplotlib: 3.7.0
Matplotlib Backend
Matplotlib backend: Qt5Agg
Python version
Python: 3.10.9 | packaged by Anaconda, Inc. | (main, Mar 1 2023, 18:18:15) [MSC v.1916 64 bit (AMD64)]
Jupyter version
No response
Installation
conda