[Phylobase-commits] r304 - branches/pdcgsoc/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Nov 26 03:40:08 CET 2008


Author: pdc
Date: 2008-11-26 03:40:07 +0100 (Wed, 26 Nov 2008)
New Revision: 304

Modified:
   branches/pdcgsoc/R/treePlot.R
Log:
small changes to phylobubble legend,  cleanup finished todo comments

Modified: branches/pdcgsoc/R/treePlot.R
===================================================================
--- branches/pdcgsoc/R/treePlot.R	2008-11-24 15:23:26 UTC (rev 303)
+++ branches/pdcgsoc/R/treePlot.R	2008-11-26 02:40:07 UTC (rev 304)
@@ -16,6 +16,8 @@
                      ...
             )
 {
+    ## TODO three dimensional histogram as example, compute values on full dataset
+    ## then generate phylo4d object with summary data and plot
     if (!isRooted(phy)) stop("treePlot function requires a rooted tree.")
     width  <- height <- (1 - margin)  ## TODO: do these have to be hard-coded?
     type   <- match.arg(type)
@@ -87,10 +89,12 @@
                             name = 'bubblelegend'))
                     legcir <- seq(bubout$min, bubout$max, length.out = 4)
                     ## print(convertUnit(bubout$bubscale, 'npc', valueOnly = TRUE))
-                    ## TODO this legend needs data values
+                    ## TODO legend currently does not resize properly
                     legcirS <- legcir * convertUnit(bubout$bubscale, 'inches', valueOnly = TRUE) / bubout$max
-                    grid.circle(seq(.2, .8, length.out = length(legcirS)), 0.5, legcirS) #, default.units = 'inches')
-                    grid.text(as.character(signif(legcir, digits = 2)), seq(.2, .8, length.out = length(legcir)), 0.1)
+                    ccol <- ifelse(legcirS < 0, 'black', 'white')
+                    legcirS <- unit(legcirS, 'npc')
+                    grid.circle(seq(.2, .8, length.out = length(legcirS)), 0.5, legcirS, gp = gpar(fill = ccol), default.units = 'npc')
+                    grid.text(as.character(signif(legcir, digits = 2)), seq(.2, .8, length.out = length(legcir)), 0.1, gp = gpar(cex = 0.75))
                 upViewport()
                     pushTree(row = 1, col = 1)
                 upViewport()
@@ -410,7 +414,6 @@
 }
 
 phylobubbles <- function(XXYY, square = FALSE, grid = TRUE) {
-    ## TODO remove data transformation from phylobubbles
     ## TODO add legend command
     ## tys   -- tip y coordinates
     ## nVars -- number of traits/characters



More information about the Phylobase-commits mailing list