Normalized densities in Gadfly

As a newcomer I’ve found Gadfly very easy to learn and elegant to use.

I encountered a little issue. A simple Geom.density seems to be non-normalized. That is, to be a function of frequencies, not probabilities.

@tlnagy is it possible to draw normalized densities? Is it perhaps implemented in the development branch of Gadfly already? I couldn’t find the appropriate parameter, although I could see some potentially related issues.


Glad you’re enjoying Gadfly!

Just to clarify, what do you mean by normalized densities? By default, Gadfly normalizes density plots to have an area under the curve (AUC) equal to 1.0. So I suspect that you have x values greater than 1 and that’s why you’re getting low values for y since AUC=1.

The implementation is quite simple and just calls KernelDensity.jl under the hood here:

Does that help?

1 Like