Skip to content

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

Closed

Description

@jdhao

Bug report

Bug summary

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

the x coordinates of the left sides of the bars

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

Code for reproduction

import matplotlib.pyplot as plt
import numpy as np
N = 3
width = 1.0
stat = [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

Activity

  1. QuLogic commented on Mar 18, 2017

    @QuLogic
    Member

    This is a duplicate of #7954.

  2. added 4 commits that reference this issue on Aug 27, 2017
    5dc4071
    e8f6cdc
    674dce4
    e078f91
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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