Hello! I'd like to have density and histogram in the same plot. I don't know why the histogram or the density have different sizes.
I've tried this:
Thank you!

library(highcharter)
x <- rnorm(500)
hist_x<- hist(x,freq=F,breaks=50,plot = FALSE)
hchart(hist_x,color="blue") %>%
hc_title(text="Hist with density") %>%
hc_add_series(density(x),type = "line", color = "red")

The y-axes differ. The histogram uses counts, which range from 0 to some number, such as 25. The density represents the fraction of the total, which ranges from 0 to 1.

Yes, I agree, and I understand you.
That is what I want to change.
It seems that in: hist_x<- hist(x,freq=F,breaks=50,plot = FALSE)
the parameter freq=F doesn't work

Maybe I am wrong on this, but it seems to me that freq=F is not working because you also use plot=FALSE . Below is a reprex in base-R yielding the histograms and densities on top of each other. I broke down the structure of hist_x which shows the density part. Here it does not sum to 1, only by multiplying by diff(breaks). The multiplication is exactly what freq=Fdoes, if I understand correctly. In your code, the assignment throughs the warning freq=F not used.
Hope this helps?