[chronojump] Better plot of ranges in powerbars



commit d8e06e52615b8822bf3ff7f856d5c58a05269a26
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Apr 1 20:21:47 2013 +0200

    Better plot of ranges in powerbars

 encoder/graph.R |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index 40ccef2..f613e32 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -726,6 +726,16 @@ paint <- function(rawdata, eccon, xmin, xmax, yrange, knRanges, superpose, highl
        }
 }
 
+textBox <- function(x,y,text,frontCol,bgCol,xpad=.1,ypad=1){
+
+       w=strwidth(text)+xpad*strwidth(text)
+       h=strheight(text)+ypad*strheight(text)
+
+       rect(x-w/2,y-h/2,x+w/2,y+h/2,col=bgCol, border=NA)
+       text(x,y,text,col=frontCol)
+} 
+
+
 paintPowerPeakPowerBars <- function(singleFile, title, paf, myEccons, Eccon, height, n) {
        pafColors=c("tomato1","tomato4",topo.colors(10)[3])
        myNums = rownames(paf)
@@ -799,8 +809,15 @@ paintPowerPeakPowerBars <- function(singleFile, title, paf, myEccons, Eccon, hei
                         bp[2,min(which(load == i))],mean(height[which(load == i)]),
                         bp[2,max(which(load == i))],mean(height[which(load == i)]),
                         lty=1,col="green")
-               text(x=mean(bp[2,which(load == i)]),y=mean(height[which(load == i)]),
-                    labels=round(mean(height[which(load == i)]),1),adj=c(.5,0),cex=.9)
+
+               myLabel = round(mean(height[which(load == i)]),1)
+
+               text(x=mean(bp[2,which(load == i)]),
+                    y=mean(height[which(load == i)]),
+                    labels=myLabel,adj=c(.5,0),cex=.9,col="darkgreen")
+               #textBox(mean(bp[2,which(load == i)]),
+               #       mean(height[which(load == i)]),
+               #       myLabel, "green", "white", ypad=1)
        }
        
        #plot legend on top exactly out


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]