-
Notifications
You must be signed in to change notification settings - Fork 247
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
[query] Fix old hl.plot.histogram log argument #11268
Conversation
hail/python/hail/plot/plots.py
Outdated
changes = { | ||
"bin_freq": [math.log10(x) if x > 0.0 else x for x in data.bin_freq], | ||
"n_larger": math.log10(data.n_larger) if data.n_larger > 0.0 else data.n_larger, | ||
"n_smaller": math.log10(data.n_smaller) if data.n_smaller > 0.0 else data.n_smaller | ||
} | ||
data = data.annotate(**changes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is wrong, because it plots count-0 and count-1 bins the same. I think the right thing to do is log(x) if x > 0.0 else shift
, where shift < 0
is arbitrary, but shift=-1
is as good as anything.
@patrick-schultz , shift = -1 can lead to some pretty ugly graphs when the range of log transformed y values is small (i.e. between 0 and 1) |
The negative 1 doesn't seem right, but we should probably give a warning or something when a user does this. I could log a warning telling user how many points were 0 and so weren't plotted? |
That seems good. Perhaps we could also suggest using |
|
…am would never work. Also have to handle the case where there are 0s
7683536
to
a016948
Compare
Struct fields are not mutable, so the log argument of hl.plot.histogram would never work. Also have to handle the case where there are 0s