r - Apply scale_colour_gradient in multiple histogram -
for set of 8 genes have performance , coverage data 3 different methods, represent @ same time both measurements. thinking plotting performance in y-axis , coverage scale_colour_gradient, like:
and data:
genes p1 p2 p3 coverage1 coverage2 coverage3 gene1 0.520 0.43 0.68 0.826 1.000 0.84 gene2 0.410 0.48 0.91 0.911 1.000 0.96 gene3 0.240 0.65 0.82 0.833 1.000 0.95 gene4 0.470 0.535 0.81 0.853 1.000 0.77 gene5 0.590 0.677 0.84 0.813 1.000 0.89 gene6 0.370 0.55 0.54 0.753 1.000 0.82 gene7 0.420 0.56 0.78 0.867 1.000 0.91 gene8 0.550 0.638 0.76 0.830 1.000 0.83
could give me guidelines on how that? i've seen examples of single scale gradient per plot, couldn't find this. know other ideas represent 2 dimensions of information @ same time?
thanks.
edit: @jimbou i've tried similar didn't expected: formatted data using melt
, changed colnames avoid confusion , plot it:
colnames(d1) <- c("genes", "performer", "performances","coverager","coverages") ggplot(d1,aes(genes, fill=performer, alpha=coverager)) + geom_bar(aes(weight=performances), position ="dodge")
but isn't same
you can specify color , alpha parameters within ggplot function. read data using copy & paste. transform data format appropriate ggplot , plot bars.
d <- read.table("clipboard",header=t) library(reshape2) d1 <- melt(d[,1:4]) d2 <- melt(d[,c(1,5:7)],value.name = "cov") d1 <- cbind(d1,d2[,-1]) head(d1) genes variable value var_cov cov 1 gene1 p1 0.52 coverage1 0.826 2 gene2 p1 0.41 coverage1 0.911 3 gene3 p1 0.24 coverage1 0.833 4 gene4 p1 0.47 coverage1 0.853 5 gene5 p1 0.59 coverage1 0.813 6 gene6 p1 0.37 coverage1 0.753 #plot ggplot(d1,aes(genes,fill=variable,alpha=cov))+ geom_bar(aes(weight=value),position = "dodge")
Comments
Post a Comment