In the basic example of the histogram generated by R highcharter package that is:
hchart(diamonds$price)
the bin width is automatically set to 200. I tried few datasets and the bin width vary. That makes me think that this is somehow set automatically. How can I set it manually?
hchart
is a generic function which work with histogram
classes too. Try following:
library(highcharter)
data(diamonds, package = "ggplot2")
h <- hist(diamonds$price, plot = FALSE)
hchart(h)
h2 <- hist(diamonds$price, breaks = 100, plot = FALSE)
hchart(h2)
So, you can create the histogram what you want using the base hist
function, then you can chart it with highcharter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With