如何在散点图矩阵中留下不显着值的空白单元格?

问题描述

我有以下情节

enter image description here

我正在尝试使这个图像这样(手动编辑),其中不重要的单元格为空白

enter image description here

我正在使用这些 r 代码

leg <- grab_legend(ggplot(data=data1,aes(x=NA,y=NA,colour=Si)) +
                     geom_line(size=2) + 
                     theme(legend.direction="horizontal",#change legend title font size
                           legend.title = element_text(size=18),#change legend text font size
                           legend.text = element_text(size=14),#change legend key size
                           legend.key.size = unit(1,'cm')))

my_fn <- function(data1,mapping,method="p",use="pairwise",...){
  
  # grab data
  x <- eval_data_col(data1,mapping$x)
  y <- eval_data_col(data1,mapping$y)
  
  # calculate correlation
  corr <- cor(x,y,method=method,use=use)
  
  # calculate colour based on correlation value
  # Here I have set a correlation of minus one to blue,# zero to white,and one to red 
  # Change this to suit: possibly extend to add as an argument of `my_fn`
  colFn <- colorRampPalette(c("blue","white","red"),interpolate ='spline')
  fill <- colFn(100)[findInterval(corr,seq(-1,1,length=100))]
  
  ggally_cor(data=data1,size=5,mapping=mapping,...) + 
    theme_void() +
    theme(panel.background=element_rect(fill=fill))
}

ggpairs(
  data1,columns=3:7,legend=leg,upper = list(continuous=my_fn),) +
  theme(legend.position='top')+
  theme(axis.text.x=element_text(angle=90,hjust=1,vjust=0.4,size=12),axis.text.y=element_text(size=12),strip.text = element_text(size = 14))

数据链接https://docs.google.com/spreadsheets/d/1q2iJ1RsRDfZQiT0UskB8PhFDU-_qTDMh2DYv9paE3bM/edit?usp=sharing

我的问题是,

如何绘制具有非显着值的空白单元格的图?谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)