Default errors for bins with negative content
Breaks with trying to plot the histogram with negative bin content.
Random.seed!(123)
h0 = Hist1D(rand(100); binedges=range(0,1,10))
h0.bincounts .-= mean(h0.bincounts)
plot(h0)
throws,
DomainError with -1.4545795461603218e29:
sqrt was called with a negative real argument but will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
Stack trace
Here is what happened, the most recent locations are first:
throw_complex_domainerror(f::Symbol, x::Float64) @ [math.jl:33](https://github.com/JuliaLang/julia/tree/8f5b7ca12ad48c6d740e058312fc8cf2bbe67848/base/math.jl#L32)
sqrt @ math.jl:608
|> @ operators.jl:926
std(h::FHist.Hist1D{Float64}) @ hist1d.jl:160
macro expansion @ FHistPlotsExt.jl:11
apply_recipe(plotattributes::AbstractDict{Symbol, Any}, h::FHist.Hist1D) @ RecipesBase.jl:300
_process_userrecipes!(plt::Any, plotattributes::Any, args::Any) @ user_recipe.jl:38
recipe_pipeline!(plt::Any, plotattributes::Any, args::Any) @ RecipesPipeline.jl:72
_plot!(plt::Plots.Plot, plotattributes::Any, args::Any) @ plot.jl:223
plot(args::Any; kw...) @ plot.jl:102
plot @ plot.jl:93
I wonder if thsi works with Makie, but yeah if you have negative bin, you can't really draw error bars. -- what's the "correct" error here?
I'd say, no error. I usually do not plot errors anyway (:stepbins).
I believe in Makie if you don't plot errorbars() you won't hit this error
The problem is still there. I'd tag this as a bug.
we had https://github.com/Moelf/FHist.jl/pull/118 as a plotting-time mitigation for Makie.jl
we need to replicate this to Plots.jl extension?
I think that the problem appear when the legend is computed (it states mean and std) - should also be present in Makie.
Could you please check