GiovineItalia / Gadfly.jl

Crafty statistical graphics for Julia.

Home Page:http://gadflyjl.org/stable/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Log-Scale Histograms fill down to value

DomHin opened this issue · comments

Hey developers,

I cannot imagine that I am the only one with this problem, but I have problems with Gadfly and Geom.histogram (same issue also with Geom.bar & Geom.hair)
In science everyone loves distributions and needs to display them in a comparable way. The best to do is just normalise them - this function works (Geom.histogram(density=true) nicely.

However, make nice plots of histograms of any type with logarithmic scale does not work with Gadfly.
Here an example:

x = randn(1000)
plot(x=x, Geom.histogram(density=true))

density_hist

BUT once you apply Scale.y_log10 it looks like that:
plot(x=x, Geom.histogram(density=true), Scale.y_log10)
density_hist_log

Obviously, it always fills until zero, which is for the log case 10e0.
The question is, is there a way to change a fill_to value for this? So that one can say that it should fill down to 10e-2 for example ?

Thanks for your help.

no, there isn't. it seems kind of undefined to me. perhaps it's best to plot points or lines instead of bars?

julia> x=randn(1000)
julia> plot(x=x, Stat.histogram(density=true), Geom.point, Scale.y_log10)

Screen Shot 2022-01-28 at 5 53 33 PM

``` julia> plot(x=x, Stat.histogram(density=true), Geom.line, Scale.y_log10) ```

Screen Shot 2022-01-28 at 5 53 42 PM

Thanks for your comment @bjarthur
Unfortunate, that there is no option to adjust this.
Some data must be drawn as histograms otherwise it could be misunderstood.