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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Aug 7 02:59:55 CEST 2008


Author: skembel
Date: 2008-08-07 02:59:55 +0200 (Thu, 07 Aug 2008)
New Revision: 266

Modified:
   branches/pdcgsoc/R/treePlot.R
Log:
Base graphics plotting sort of working, fixed NA issue with base plots, need to sort out par(new=TRUE) issue still

Modified: branches/pdcgsoc/R/treePlot.R
===================================================================
--- branches/pdcgsoc/R/treePlot.R	2008-08-07 00:17:56 UTC (rev 265)
+++ branches/pdcgsoc/R/treePlot.R	2008-08-07 00:59:55 UTC (rev 266)
@@ -54,12 +54,15 @@
     
     if(plot.data) {
         if(tip.plot.fun == "density") {
+
             tmin <- min(tdata(phy, which = 'tip'))
             tmax <- max(tdata(phy, which = 'tip'))
             tip.plot.fun <- function(x) {
-                par(plt=gridFIG(),new=TRUE)
-                plot(density(t(x)),xlim=c(tmin,tmax))
-                }
+                par(plt=gridFIG())   
+                par(new=TRUE)          
+                plot(density(t(x)),xlim=c(tmin,tmax),axes=FALSE,main="",xlab="",ylab="")
+            }
+           
         }
         if(is.function(tip.plot.fun)) {
             datalayout <- grid.layout(ncol = 2,
@@ -339,7 +342,7 @@
     
     tys <- XXYY$yy[phy at edge[, 2] <= nTips(phy)]
     
-    traits <- phy at tip.data
+    traits <- tdata(phy,which="tip")
 
     maxr <- ifelse(ncol(traits) > nTips(phy), 1/ncol(traits), 1/nTips(phy))
 
@@ -378,7 +381,9 @@
     ))
     grid.segments(x0 = 0,  x1 = 1, y0 = tys, y1 = tys, gp = gpar(col = 'grey'))
     grid.segments(x0 = xpos,  x1 = xpos, y0 = 0, y1 = 1, gp = gpar(col = 'grey'))
-    grid.text('x', naxs, nays)
+    if (length(naxs)>0) {
+        grid.text('x', naxs, nays)
+    }
     if(square) {
         # to keep the squares square, yet resize nicely use the square npc
         sqedge <- unit(unlist(traits), 'snpc')



More information about the Phylobase-commits mailing list