8 D# P# `: N8 J: F1 r# Packages% b! O! c1 W% x# \: x5 \5 D
library(hexbin)1 I. H) i2 v2 W) u9 L: i& M
library(RColorBrewer) 3 e: l1 C/ r% T2 v8 T0 G8 N/ P9 b! o d# X+ T: H% j% _
# Create data& O7 J3 m& M W% d& T
x <- rnorm(mean=1.5, 5000)+ Q2 a1 B9 L8 _' \
y <- rnorm(mean=1.6, 5000) ' x _3 h# M( J& Y; h c$ e$ t5 a. I
3 f+ G/ o* e3 x: f# q( ]# Make the plot ' g. Q. i {7 }4 A4 ?9 s7 sbin<-hexbin(x, y, xbins=40)! ]9 a* j" t; W+ `7 T
my_colors=colorRampPalette(rev(brewer.pal(11,'Spectral')))8 B: H m. N' d& Q1 ~- r/ A
plot(bin, main="" , colramp=my_colors , legend=F ) 0 o2 \+ W7 Z1 U' Y 8 s. S( X% M J3 w' g" ~0 c, `" s! O / U. }# @$ h$ d4 a& v# t / k1 @5 r4 I. R" H( c; m