Skip to content
This repository has been archived by the owner on Jun 29, 2021. It is now read-only.

plot(histogram,fill(1.5,5)) is an empty plot #62

Open
smldis opened this issue Mar 5, 2019 · 8 comments
Open

plot(histogram,fill(1.5,5)) is an empty plot #62

smldis opened this issue Mar 5, 2019 · 8 comments

Comments

@smldis
Copy link

smldis commented Mar 5, 2019

Hi,
plot(histogram,fill(1.5,5)) is an empty plot and the repl output is:

plot(histogram,fill(1.5,5))
┌ Warning: Founds 0 width in scene limits: Float32[3.5, 0.0, 0.0] .. Float32[3.5, 0.0, 0.0]
└ @ AbstractPlotting C:\Users\smldis\.julia\packages\AbstractPlotting\KIwn9\src\interfaces.jl:686
┌ Warning: Founds 0 width in scene limits: Float32[3.5, 0.0, 0.0] .. Float32[3.5, 0.0, 0.0]
└ @ AbstractPlotting C:\Users\smldis\.julia\packages\AbstractPlotting\KIwn9\src\interfaces.jl:686
```
@piever
Copy link
Member

piever commented Mar 5, 2019

Thanks for reporting. The problem may come from StatsBase though (edges and weights seem incorrect):

julia> using StatsBase

julia> fit(Histogram, fill(1.5, 5))
Histogram{Int64,1,Tuple{StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}}
edges:
  2.5:2.0:4.5
weights: [0]
closed: left
isdensity: false

@piever
Copy link
Member

piever commented Mar 5, 2019

Here is the issue in StatsBase JuliaStats/StatsBase.jl#456. Things should work here as soon as StatsBase implements a fix for the "mono valued vector" here (we rely on StatsBase for histogram computation).

@smldis
Copy link
Author

smldis commented Mar 6, 2019

@piever Could you define your requirements for the histrange function?
I need to improve my current PR to StatsBase since it is not fixing this issue while it is fixing JuliaStats/StatsBase.jl#456.

julia> StatsBase.histrange(0.5, 0.5, 5)
0.5:5.0e-15:0.500000000000015

@piever
Copy link
Member

piever commented Mar 6, 2019

Thanks for fixing this! I think it's important to have the weights of the histogram sum to the correct value (before they were 0). There may be issues due to such a small binsize (for example, given that GLMakie runs on the GPU, some of the logic is probably in single floating point precision). Should we just give a warning id the data span is too small?

@smldis
Copy link
Author

smldis commented Mar 6, 2019

I tried with Rebugger but I was unable to step into the second layer of fit(...) and its hard to understand from the generated functions how the weights and edges are computed. I might try harder soon

@smldis
Copy link
Author

smldis commented Mar 6, 2019

Should we just give a warning id the data span is too small?

Actually we could check for this specific case and make a good plot with only one bin.

@smldis
Copy link
Author

smldis commented Mar 8, 2019

plot(histogram,fill(Float32(1.3),5))
actually works with my patch to StatsBase JuliaStats/StatsBase.jl#479

So one possible solution would be to fit the histogram with data converted to 32bit.
Another solution would be to handle this small range case on Makie's backend side.

@piever
Copy link
Member

piever commented Mar 8, 2019

Sure, I'll look into it after the StatsBase PR is merged (just ping me here where that happens).

@piever piever reopened this Mar 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants