-
Notifications
You must be signed in to change notification settings - Fork 12
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
clamp_errors
options for Makie Errorbars and clamp_bincounts
for histograms
#118
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #118 +/- ##
==========================================
- Coverage 80.37% 77.99% -2.39%
==========================================
Files 11 11
Lines 790 818 +28
==========================================
+ Hits 635 638 +3
- Misses 155 180 +25 ☔ View full report in Codecov by Sentry. |
Thanks for looking into this! I still think it would be very useful to clip both negative/zero values and errors to positive, to do plots in log scale. I'm quite frequently getting into errors for non-compatible values for log scale. It's true that one could avoid it by choosing more wisely the binning of histograms, but when you need to run on high number of events and a bit more complex selections it isn't really obvious what's the best binning, and it's very likely to end up with empty bins. For several MC generators, it's also quite common to get negative weights, which can produce negative valued bins. So I'd love to have an option to clip bin counts and errors! If you believe this is more of an edge case, we could set it as not being the default behaviour. |
Negative bin counts tell you something is happening with the MC, and users should take conscious decisions about it, we don't want to silently produce incorrect visualization is my take. I'm happy to clamp error bars automatically |
Totally agree that we shouldn't silently produce incorrect visualization, indeed I think it would bet better to not have on this feature by default. |
stephist(h); errorbars!(h; clamp=false); current_figure() julia> stephist(h); errorbars!(h); current_figure() julia> stephist(h); errorbars!(h; error_function=FHist.pearson_err); current_figure() @sfranchel how about this? |
Ok, that looks good. Maybe I'd make the default |
ah, right now it only clamps the error bars -- since it's a keyword argument to the Actually, I think for the |
one caveat is that until MakieOrg/Makie.jl#3904 is addressed, |
julia> h = Hist1D(;binedges=0:2, bincounts=[-0.1, 0.1], sumw2=[0.1, 0.1])
edges: [0.0, 1.0, 2.0]
bin counts: [-0.1, 0.1]
total count: 0.0
julia> clamp_bincounts = true; clamp_errors=true;
julia> barplot(h; clamp_bincounts); errorbars!(h; clamp_bincounts, clamp_errors); current_figure()
|
error_function
options for Makie Errorbarsclamp_errors
options for Makie Errorbars and clamp_bincounts
for histograms
Thanks a lot @Moelf , this looks great!! Very much appreciated |
This is an alternative to #116 @sfranchel
I'm a bit hesitant to clip the error bars to positiveDO NOT MERGEBlocked by MakieOrg/Makie.jl#3901The following works on older Makie but not the latest one, I think it's a bug