سؤال

I'm trying to produce a specific plot using ggpairs of the GGally package with code like the following:

data(tips, package="reshape")
pm <- ggpairs(tips[,1:3], axisLabels="none")

My problem is that I can't figure out how to remove the labels "total_bill", "tip", "sex" from the sides of the plot. Is there a way of doing this?

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

المحلول

By doing:

 data = tips[,1:3]
 pm <- ggpairs(data)
 g11<-ggally_blank() 

 for(i in 1:ncol(data)) {
     for(j in 1:ncol(data)) {
         if(i<=j) {
             pm <- putPlot(pm, g11, i, j)
         }
     }
 }

You get rid of the axisLabels from the side of the plot, and you get a 'blank' graph in the diagonal and upper triangle of the graph (as requested). In your case, the "18 columns" would be captured by ncol(data) in the loop. Does that work?

It would look like this: enter image description here

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