Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
duncanmmacleod opened this issue Apr 1, 2014 · 6 comments
Closed

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

duncanmmacleod opened this issue Apr 1, 2014 · 6 comments
Milestone

Comments

@duncanmmacleod
Copy link
Contributor

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.

@tacaswell
Copy link
Member

What version did you test this on?

@duncanmmacleod
Copy link
Contributor Author

1.3.1 (macports) and 1.4.x (HEAD of master).

@tacaswell tacaswell added this to the v1.4.0 milestone Apr 19, 2014
@tacaswell
Copy link
Member

@duncanmmacleod Could you put that patch in a PR please?

@neggert Do you have time to look at this (sorry to keep pestering you, but you are in my brain as the current histogram expert)?

@neggert
Copy link
Contributor

neggert commented Apr 20, 2014

Yup, looks like that patch should do the trick. Just need a PR for it. If you could modify one of the existing histogram tests to pick this up, that would be good.

@tacaswell No problem.

@tacaswell
Copy link
Member

closed by #3089

@pelson
Copy link
Member

pelson commented Jun 18, 2014

Do you have time to look at this (sorry to keep pestering you, but you are in my brain as the current histogram expert)

P.S. That is a good thing @tacaswell - @neggert has done some great work on this aspect of mpl and is rightfully the "mpl histogram expert". 👍 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants