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

bars in plt.bar graph centered on "left" value #8882

Closed
@skjaeve

Description

@skjaeve

Bug report

Bug summary

Docstring for plt.bar:

matplotlib.pyplot.bar(left, height, width=0.8, bottom=None, hold=None, data=None, **kwargs)
Make a bar plot.

Make a bar plot with rectangles bounded by:

left, left + width, bottom, bottom + height
(left, right, bottom and top edges)

However, "left" is in fact the center value of the resulting bars.

Code for reproduction

# Paste your code here##importnumpyasnpimportmatplotlib.pyplotaspltlefts=np.asarray((0,100,200,300,400))plt.bar(left=lefts,height=lefts,width=100)plt.bar(left=lefts,height=lefts,width=75)plt.bar(left=lefts,height=lefts,width=50)plt.bar(left=lefts,height=lefts,width=25)

Actual outcome
mwe-bar

# If applicable, paste the console output here##

Expected outcome
Bars should be left-aligned to the "left" value.
As the attached plot shows: Bars are centered on "left" value, and not left-aligned to it.

Matplotlib version

  • Operating System: Fedora Linux 26
  • Matplotlib Version: 2.0.2
  • Python Version: 3.6
  • Jupyter Version (if applicable):
  • Other Libraries:

matplotlib installed using pip

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