[Phylobase-commits] r117 - in pkg: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Feb 23 14:52:13 CET 2008


Author: jombart
Date: 2008-02-23 14:52:13 +0100 (Sat, 23 Feb 2008)
New Revision: 117

Modified:
   pkg/R/plot.R
   pkg/TODO
   pkg/man/geospiza.Rd
Log:
Plot the tree of a phylo4d when no tip data are available.


Modified: pkg/R/plot.R
===================================================================
--- pkg/R/plot.R	2008-02-23 13:25:32 UTC (rev 116)
+++ pkg/R/plot.R	2008-02-23 13:52:13 UTC (rev 117)
@@ -31,7 +31,7 @@
               
     #### preliminary stuff and checks
     if(!require(ape)) stop("the ape package is required")   
-    if(ncol(tdata(x,which="tip")) == 0) stop("no data in this phylo4d object")
+    ## if(ncol(tdata(x,which="tip")) == 0) stop("no data in this phylo4d object")
     
     cex <- par("cex")
     symbol <- match.arg(symbol)
@@ -40,6 +40,13 @@
     ## convert the tree into phylo
     tre <- suppressWarnings(as(x,"phylo"))
     tre$node.label <- x at node.label # this should be done by the as(x,"phylo")
+    ## plot only tree if no tip data
+    if(ncol(tdata(x,which="tip")) == 0) {
+         plot.phylo(tre, type=treetype, direction="rightwards", show.tip.label=show.tip.label,
+                          show.node.label=show.node.label, cex=cex.label,
+                          no.margin=FALSE, x.lim=NULL, y.lim=NULL, ...)
+         return(invisible())
+     }   
 
     #### data handling
     ## retrieve data

Modified: pkg/TODO
===================================================================
--- pkg/TODO	2008-02-23 13:25:32 UTC (rev 116)
+++ pkg/TODO	2008-02-23 13:52:13 UTC (rev 117)
@@ -15,7 +15,7 @@
   * modify phylo4 method to allow "Singles" (plot.phylo doesn't)? What are 'singles'? One single descendent for a node?
   * plotting with data and `show.node.label` scrambles order of node labels *this is really a problem with ade4 vs ape ordering of nodes* -- [fixed since we no longer use ade4 for plotting] TJ
   * multiPhylo4x plotting
-  * plot the tree when no data are stored in a phylo4d instead of throwing an error
+  * plot the tree when no data are stored in a phylo4d instead of throwing an error -- [done] TJ
 
 ## Data classes
 ### Tree model:

Modified: pkg/man/geospiza.Rd
===================================================================
--- pkg/man/geospiza.Rd	2008-02-23 13:25:32 UTC (rev 116)
+++ pkg/man/geospiza.Rd	2008-02-23 13:52:13 UTC (rev 117)
@@ -26,6 +26,6 @@
 }
 \examples{
 data(geospiza)
-plot(geospiza)
+plot(geospiza,adj=.4,cex.lab=.7,cex.sym=.8)
 }
 \keyword{datasets}



More information about the Phylobase-commits mailing list