# NOT RUN {
library(ggplot2)
library(hexbin)
dat <- data.frame(x = rnorm(10000), y = rnorm(10000))
ggplot(dat, aes(x = x, y = y)) +
geom_hex() + coord_fixed() +
scale_fill_gradientn(colours = hp(256, house = "Hufflepuff"))
# using code from RColorBrewer to demo the palette
n = 200
image(
1:n, 1, as.matrix(1:n),
col = hp(n, house = "Slytherin"),
xlab = "hp n", ylab = "", xaxt = "n", yaxt = "n", bty = "n"
)
# }
Run the code above in your browser using DataLab