# How to create a hexbin chart in R

**Data Science Tutorials**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The post How to create a hexbin chart in R appeared first on Data Science Tutorials

What do you have to lose?. Check out Data Science tutorials here Data Science Tutorials.

How to create a hexbin chart in R, The hexbin package in base R provides a function with the same name that creates a plottable hexbin object, which can be used to make a hexbin chart.

# install.packages("hexbin") library(hexbin) # Data set.seed(123) x <- rnorm(5000) y <- rnorm(5000) hex <- hexbin(x, y) plot(hex)

How to do Conditional Mutate in R? – Data Science Tutorials

**Number of bins**

The number of bins is controlled by the xbins option. 30 is the default value.

hex <- hexbin(x, y, xbins = 20) plot(hex)

Best Books to learn Tensorflow – Data Science Tutorials

**Border color**

hex <- hexbin(x, y) plot(hex, border = 4)

**Color palette**

hex <- hexbin(x, y) plot(hex, colramp = colorRampPalette(hcl.colors(12)))

What is Ad Hoc Analysis? – Data Science Tutorials

**Remove the legend**

hex <- hexbin(x, y) plot(hex, legend = FALSE, colramp = colorRampPalette(hcl.colors(12, "GnBu")))

Convert multiple columns into a single column-tidyr Part4 (datasciencetut.com)

The post How to create a hexbin chart in R appeared first on Data Science Tutorials

Learn how to expert in the Data Science field with Data Science Tutorials.

**leave a comment**for the author, please follow the link and comment on their blog:

**Data Science Tutorials**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.