Skip to content

Bug in y-minimum for weighted, log, stepped Axes.hist #2945

Closed
@duncanmmacleod

Description

@duncanmmacleod

I think there is a bug in Axes.hist for the specific combination of log=True, histtype='step{filled}', weights=[something small], where the y-minimum is set to 1/base despite the possibility of weights << 1. Please see the following example:

from numpy import (ones_like, random)
from matplotlib import pyplot
data = random.normal(size=10000)
fig = pyplot.figure()
ax = fig.gca()
ax.hist(data, log=True, histtype='step', weights=ones_like(data) * 1e-5)
fig.show()

with log=False, the figure looks normal, while with log=True the patch minimum is set to 0.1 (> 1e-5) meaning the patches are all 1-D lines at 0.1.

I believe this patch should fix the problem.

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