Skip to content

axes.bar supports values given as dict_values yet axes.barh throws an error #14693

@AoifeHughes

Description

@AoifeHughes

Bug report

Bug summary
Calling axes.barh will throw this error if the height of the bars are given as a dictonary values type
TypeError: unsupported operand type(s) for +: 'int' and 'dict_values'

Code for reproduction

import matplotlib.pyplot as plt

data = {'cats': 10, 'dogs': 20}

# Works as expected
fig, ax = plt.subplots(1)
ax.bar(range(len(data)), data.values())

# Doesn't work
fig, ax = plt.subplots(1)
ax.barh(range(len(data)), data.values())

# Works as expected
fig, ax = plt.subplots(1)
ax.barh(range(len(data)), list(data.values()))

plt.show()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    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