Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Bug]: Bug / Inconsistency: Title Format Lost After Interactive Editing #30770

Open
@mdmalik95

Description

@mdmalik95

Bug summary

When a figure is plotted with a bold/dark title or legend, e.g.:

Image

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:

Image

→ the title formatting immediately resets, e.g.:

  • Bold becomes normal
  • Color lightens or resets
  • Weight lost

example: like

Image

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.

Image

Expected outcome

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

Image

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp