Commit id: 8450c8e87951a6eafa247c28535dd93b7d9aa9fa
o update add_colorbar <2015-05-21, Thu>
git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/ggtree@104028 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
CHANGES IN VERSION 1.1.6 |
2 | 2 |
------------------------ |
3 |
+ o update add_colorbar <2015-05-21, Thu> |
|
3 | 4 |
o add example of add_legend and gheatmap in vignette <2015-05-18, Mon> |
4 | 5 |
o gheatmap implementation of gplot <2015-05-18, Mon> |
5 | 6 |
o add_legend for adding evolution distance legend <2015-05-18, Mon> |
... | ... |
@@ -483,9 +483,13 @@ add_colorbar <- function(p, color, x=NULL, ymin=NULL, ymax=NULL, font.size=4) { |
483 | 483 |
|
484 | 484 |
i <- seq(1, length(y), length.out = 5) %>% round(0) |
485 | 485 |
offset <- diff(range(p$data$x))/40 |
486 |
+ barwidth <- offset/5 |
|
487 |
+ |
|
486 | 488 |
p + annotate("text", x=x+offset*2, y=y[i], label=legend[i,1], size=font.size) + |
487 | 489 |
annotate("rect", xmin=x, xmax=x+offset, ymin=ymin, |
488 |
- ymax = ymax, fill=legend[,2], color=legend[,2]) |
|
490 |
+ ymax = ymax, fill=legend[,2], color=legend[,2]) + |
|
491 |
+ annotate("segment", x=x, xend=x+barwidth, y=y[i], yend=y[i], color="white") + |
|
492 |
+ annotate("segment", x=x+offset-barwidth, xend=x+offset, y=y[i], yend=y[i], color="white") |
|
489 | 493 |
|
490 | 494 |
} |
491 | 495 |
|