Skip to content

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

@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
#
#
import numpy as np
import matplotlib.pyplot as plt
lefts = 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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy