简体   繁体   中英

Using stat_binhex() with ggpairs()

I would like to use the stat_binhex() statistic from ggplot2 with the ggpairs() function ( GGally R package). For example, I would like to use stat_binhex() in this plot instead of geom_point() . Is that possible?

在此输入图像描述

Thanks for your help!

set.seed(1)
library(GGally)
library(hexbin)
df <- as.data.frame(matrix(rnorm(20*3), ncol=3))
p <- ggpairs(df, lower="blank")
seq <- 1:ncol(df)
for (x in seq)
  for (y in seq) 
    if (y>x) 
      p <- putPlot(p, ggplot(df, aes_string(x=names(df)[x],y=names(df)[y])) + stat_binhex(bins=4), y,x)
p

截图

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM