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]: Global legend weird behaviors #26841

Closed
Milestone
@imxtx

Description

@imxtx

Bug summary

The color of the global legend for all subplots does not match the label colors.

Code for reproduction

esbs=np.array(list(range(0,41)))lines= [eforeinasrs]colors= ['dodgerblue','tomato','yellowgreen','orange','dodgerblue','tomato','yellowgreen','orange']labels= ['A','C','M','F','A+','C+','M+','F+',]linestyles= ['-','-','-','-','--','--','--','--']fig,axs=plt.subplots(2,figsize=(6,6),sharex=False)handles= []foriinrange(8):print(i,colors[i],labels[i])ifi==3ori==7:h=axs[1].plot(esbs,lines[i],color=colors[i],linewidth=1.2,linestyle=linestyles[i],label=labels[i])else:h=axs[0].plot(esbs,lines[i],color=colors[i],linewidth=1.2,linestyle=linestyles[i],label=labels[i])handles.append(h)fig.legend(handles,labels=labels,ncol=2,bbox_to_anchor=(0.15,1.06),loc='upper left')plt.show()

Actual outcome

image

Expected outcome

The colors for legend F and legend F+ should be orange. But they are different.

Additional information

No response

Operating system

No response

Matplotlib Version

3.7.1

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp