if(requireNamespace("hexbin", quietly = TRUE)) {
if (requireNamespace('data.table', quietly = TRUE)) {
# don't multi-thread during CRAN checks
data.table::setDTthreads(1)
}
set.seed(634267)
dframe = data.frame(x = rnorm(1000), y = rnorm(1000))
print(HexBinPlot(dframe, "x", "y", "Example hexbin"))
diamonds = ggplot2::diamonds
print(HexBinPlot(diamonds, "carat", "price", "Diamonds example"))
# change the colorscale
print(HexBinPlot(diamonds, "carat", "price", "Diamonds example",
lightcolor="#fed98e",
darkcolor="#993404"))
}
Run the code above in your browser using DataLab