r - with GGplot2 is there a way to select only 1 chart from a graph with multiple correlation charts -


lets have following graph: enter image description here

and want select 2nd graph of first row. how can ggplot function below:

plotall<-function(data,size=2, alpha=0.4){   combs <- expand.grid(names(data), names(data))   out <- do.call(rbind, apply(combs, 1, function(x) {     tt <- data[, x]; names(tt) <- c("v1", "v2")     tt <- cbind(tt, id1 = x[1], id2 = x[2])   }))    library(plyr)   df.text=ddply(out[out$id1==out$id2,],.(id1,id2),summarise,                 pos=max(v1)-(max(v1)-min(v1))/2)   out[out$id1==out$id2,c("v1","v2")]<-na   out$labels <- rownames(out)   out$labels<-sapply(out$labels, function(x){     strsplit(x, "_")[[1]][1]   })    fam<-read.table('input/genomic_info_subset.tsv', sep='\t')    idx<-match(out$labels,fam$v1)   newcol<-fam$v4[idx]   newcol<-as.character(newcol)   out$fam<-newcol    ggplot(data = out, aes(x = v2, y = v1)) +     geom_text(data = out[!is.na(out$v1),], aes(label = labels, colour=fam), size=size, alpha=alpha) +     facet_grid(id1 ~ id2,scales="fixed")+     geom_text(data=df.text,aes(pos,pos,label=id1)) + geom_abline( slope=1 ) +      ggtitle("corralation between measured & calculated affinities") +     ylab("") + xlab("") + theme(panel.grid.minor.x=element_blank(), panel.grid.major.x=element_blank()) } 

so can somewhere in code, select 2nd of 1st row? or more easy extract data frame out of function , plot 1 separate? know function inappropriate reproducing question, if neccecary provide .tsv , dput data.

by far easiest solution subset data relevant second column of first row. extracting plots these kinds of facet plots possible, not trivial.


Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -