Is it possible to add confidence interval values to GGally:ggpairs
plot? Thought that it would be possible via GGally::ggpairs(data, upper = list(continuous = ggcorr))
with an adjusted version of ggcorr()
, but I have been unable to understand the internal code. Ideally, a GGally::ggpairs
version of [this][1] plot would be ideal.
[Plot from http://handlesman.blogspot.com/2011/03/matrix-plot-with-confidence-intervals.html][2]
EDIT:
This is my closest attempt, but can't work out adjusting the placement of the annotation for each cell in the matrix.
my_high <- function(data, mapping, ...){
p <- ggally_cor(data, mapping = mapping)+annotate("text",x=0,y=0,label=paste0("[",round(cor.test(data[,1],data[,2],method = "pearson",conf.int=0.95)$conf.int[1],3),",",round(cor.test(data[,1],data[,2],method = "pearson",conf.int=0.95)$conf.int[2],3),"]"))
return(p)
}
GGally::ggpairs(data, upper = list(continuous = my_high))```
[1]: https://i.stack.imgur.com/XWNyb.png
[2]: https://i.stack.imgur.com/7j2Qb.png