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

Closed
jdhao opened this Issue Mar 18, 2017 · 1 comment

Comments

Projects
None yet
2 participants

jdhao commented Mar 18, 2017

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
Member

QuLogic commented Mar 18, 2017

This is a duplicate of #7954.

QuLogic closed this Mar 18, 2017

QuLogic added the Duplicate label Mar 18, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment