[Phylobase-commits] r270 - branches/pdcgsoc/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Aug 7 06:35:44 CEST 2008
Author: pdc
Date: 2008-08-07 06:35:44 +0200 (Thu, 07 Aug 2008)
New Revision: 270
Modified:
branches/pdcgsoc/R/treePlot.R
Log:
can't compare a function to string
Modified: branches/pdcgsoc/R/treePlot.R
===================================================================
--- branches/pdcgsoc/R/treePlot.R 2008-08-07 04:21:50 UTC (rev 269)
+++ branches/pdcgsoc/R/treePlot.R 2008-08-07 04:35:44 UTC (rev 270)
@@ -58,23 +58,24 @@
}
if(plot.data) {
- if(tip.plot.fun == "density") {
- if(!require(gridBase)) {
- stop('To plot using base graphics (including the "density" plot)
- you need install the "gridBase" package')
- }
- tmin <- min(tdata(phy, which = 'tip'), na.rm = T)
- tmax <- max(tdata(phy, which = 'tip'), na.rm = T)
- tip.plot.fun <- function(x) {
- if(!all(is.na(x))) {
- # hack, set th plotting region to the grid fig region
- par(plt = gridFIG(), new = TRUE)
- dens <- density(x, na.rm = TRUE)
- plot.density(dens, xlim = c(tmin, tmax), axes = FALSE,
- main = "", xlab = "", ylab = "")
+ if(!is.function(tip.plot.fun)) {
+ if(tip.plot.fun == "density") {
+ if(!require(gridBase)) {
+ stop('To plot using base graphics (including the "density" plot)
+ you need install the "gridBase" package')
}
- }
-
+ tmin <- min(tdata(phy, which = 'tip'), na.rm = T)
+ tmax <- max(tdata(phy, which = 'tip'), na.rm = T)
+ tip.plot.fun <- function(x) {
+ if(!all(is.na(x))) {
+ # hack, set th plotting region to the grid fig region
+ par(plt = gridFIG(), new = TRUE)
+ dens <- density(x, na.rm = TRUE)
+ plot.density(dens, xlim = c(tmin, tmax), axes = FALSE,
+ main = "", xlab = "", ylab = "")
+ }
+ }
+ }
}
if(is.function(tip.plot.fun)) {
datalayout <- grid.layout(ncol = 2,
More information about the Phylobase-commits
mailing list