سؤال

I wonder how to integrate three variables in one figure as the example in the attached picture. How to realize that the "number of pairs" are denoted by different shades?

هل كانت مفيدة؟

المحلول

set.seed(42)
DF <- data.frame(x=runif(1e5), y=rpois(1e5,20))

library(ggplot2)
ggplot(DF, aes(x,y)) + stat_bin2d()

enter image description here

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top