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

Inconsistency between documentation and actual effect of the bar plot function #8327

Closed
@jdhao

Description

@jdhao

Bug report

Bug summary

There is an inconsistency between thematplotlib's documentation and actual outcome of the bar plot function. The documentation says thatleft argument in the bar plot function indicate

the x coordinates of the left sides of the bars

In fact, theleft parameter indicate the center of the bar.

Code for reproduction

importmatplotlib.pyplotaspltimportnumpyasnpN=3width=1.0stat= [2.4,3.2,1.6]ind=np.arange(1,6,2,dtype=np.float32)fig,ax=plt.subplots()ax.bar(ind,stat,width )ax.set_xticks(ind+width/2.0)plt.show()

Actual outcome and expected outcome

The x axis ticks should be in the center of bar if the documentation is right. In fact, the ticks are in the right side of each bar. See figure below
image

Matplotlib version

  • Matplotlib version: 2.0.0
  • Python version: 2.7.13 and 3.5.2
  • Platform: Linux (CentOS 7) and Windows
  • How did you install Matplotlib and Python: Anaconda

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