dens2Dplot | R Documentation |
This function generates a scatter plot enhancing density with different colors.
dens2Dplot(x, y, nbins=100, pal=NULL, xlab='', ylab='', xlim=c(NA,NA),
ylim=c(NA,NA), ...)
x , y |
Variables for the scatter plot. |
nbins |
Number of bins in X and Y coordinates of the scatter plot. |
pal |
Color palette |
xlab , ylab |
Labels for X and Y axis |
xlim , ylim |
Limits for X and Y axis |
... |
Other graphic parameters |
This function has been inspired by Elzizi's answer at http://stackoverflow.com/questions/18089752/r-generate-2d-histogram-from-raw-data The user can add a grid, title and other details to the scatter plot.
n=1000000; x=rnorm(n,15,4); y=x+rnorm(n,5,6)
dens2Dplot(x,y,xlab='Variable X',ylab='Variable Y',las=1)
## Let's add a grid and a title:
grid(col=grey(.4))
title('Example of dens2Dplot')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.