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

Broken legend auto-position with step*-type histograms #9580

Closed
Assignees
afvincent
Milestone
@afvincent

Description

@afvincent

Bug report

Bug summary

Automatic placing of legend seems to be not working with histograms of typestep*. If I am correct, this is a new entry in the long list of current issues with legend ^^.

Code for reproduction

importmatplotlib.pyplotasplthist_types= ('bar','barstacked','step','stepfilled')fig,axs=plt.subplots(nrows=len(hist_types),num="test")forax,htinzip(axs.flat,hist_types):ax.set_title(ht)ax.hist([0]+5*[9],bins=range(10),label=f"This is a label",histtype=ht)ax.legend(loc="best")fig.tight_layout()#fig.savefig(fig.get_label() + ".png")

Actual outcome

Matplotlib 2.1

test

Expected outcome

The same auto-position of the legend on each subplot, i.e.upper left, whatever is the histogram style.

Matplotlib version

  • Operating system: GNU/Linux (Fedora 26)
  • Matplotlib version: 2.1 from conda (also test “successfully” with master)
  • Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg
  • Python version: 3.6.3 from conda
  • Jupyter version (if applicable): X
  • Other libraries: X

FWIW, I tried the above snippet on Matplotlib 1.5.0 and the result is similar.

Edit: tweaked a bit the snippet to be Matplotlib v1.5.x-compliant.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp