Skip to content

Feature request: show bars in plt.hist #12874

Closed as not planned
Closed as not planned
@rosgori

Description

@rosgori

Feature request

Summary

With the new style of plotting (after version 1.5), you cannot distinguish the bars on plt.hist. Take for example the old way:

import matplotlib.pyplot as plt
import random

l_n = []
for _ in range(2000):
    l_n.append(random.betavariate(5, 25))

with plt.style.context('classic'):
    plt.hist(l_n, bins=20)
    plt.show()

Unfortunately, I cannot upload images. Nevertheless, you can see the bars. Now, this:

plt.hist(l_n, bins=20)
plt.show()

You only see the silhouette of the histogram, not the bars. An easy way to solve this:

plt.hist(l_n, bins=20, edgecolor='w')
plt.show()

edgecolor='w' would be the default option (I would prefer white because it looks good with all the styles). What do you think?

By the way, if you want to compare with other software, I think all of them show bars. And a quick search shows...

Matplotlib version

  • Operating system: Ubuntu 16.04.5 LTS
  • Matplotlib version: 3.0.1
  • Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg
  • Python version: 3.6.6
  • Jupyter version (if applicable): 7.1.1
  • Other libraries:
  • How I installed matplotlib: conda

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.status: inactiveMarked by the “Stale” Github Actiontopic: histtopic: rcparams

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions