Skip to content

plt.hist does not obey the hist.bins rcparams #7356

Closed
@anntzer

Description

@anntzer

2.0b4 and master

import matplotlib as mpl
from matplotlib import pyplot as plt
import numpy as np

mpl.rcdefaults()
mpl.rcParams["hist.bins"] = "auto"

np.random.seed(1)
x = np.random.rand(1000)
n0, b0, p0 = plt.hist(x)
n1, b1, p1 = plt.hist(x, "auto")
print(n0)
print(n1)
plt.show()

The first histogram has 10 bins, the second one has 11 bins.

Note that this does not affect calling the hist method on an explicitly created Axes object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty: Easyhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issues

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions