Skip to content

A #9178

@venuur

Description

@venuur

Bug report

Bug summary

The method matplotlib.axes._subplots.AxesSubplot.bar has argument left which is actually the center of the bar. The name of the argument leads to unexpected results.

Code for reproduction

import matplotlib.pyplot as plt

left = [0, 1, 3]
width = [1, 2, 1]
height = [1, 1, 1]
bottoms = [0, 1, 2]

# Actual
fig, ax = plt.subplots()
for l, w, h, b in zip(left, width, height, bottoms):
    ax.bar(left=l, width=w, height=h, bottom=b, color='blue')
plt.show()    
    
# Expected
fig, ax = plt.subplots()
for l, w, h, b in zip(left, width, height, bottoms):
    ax.bar(left=l + w/2, width=w, height=h, bottom=b, color='blue')
plt.show()

Actual outcome

The following is an text representation of the figure produced:

  3
  |                                                [------------------]
  2
  |        [--------------------------------]
  1 
  |  [-------------]
-0.5-----0.0-----0.5-----1.0-----1.5-----2.0-----2.5-----3.0-----3.5-----4.0**

Expected outcome

The following is an text representation of the figure produced:

  3
  |                                                      [------------------]
  2
  |                     [--------------------------------]
  1 
  |       [-------------]
-0.5-----0.0-----0.5-----1.0-----1.5-----2.0-----2.5-----3.0-----3.5-----4.0**

Matplotlib version

  • Operating System: Windows 10.0.15063
  • Matplotlib Version: 2.0.2
  • Python Version: Python 3.6.1 |Anaconda custom (64-bit)| (default, May 11 2017, 13:25:24) [MSC v.1900 64 bit (AMD64)] on win32
  • Jupyter Version (if applicable):
  • Other Libraries:

conda install matplotlib

Using default channel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions