[Phylobase-commits] r201 - branches/pdcgsoc/misc
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Jul 14 19:38:11 CEST 2008
Author: pdc
Date: 2008-07-14 19:38:11 +0200 (Mon, 14 Jul 2008)
New Revision: 201
Modified:
branches/pdcgsoc/misc/temp.R
Log:
Smarter label handling and other tweaks
Modified: branches/pdcgsoc/misc/temp.R
===================================================================
--- branches/pdcgsoc/misc/temp.R 2008-07-14 07:45:28 UTC (rev 200)
+++ branches/pdcgsoc/misc/temp.R 2008-07-14 17:38:11 UTC (rev 201)
@@ -7,7 +7,8 @@
tip.order = NULL,
plot.data = FALSE,
rot = 0,
- tip.plot.fun = function() {grid.points()}
+ tip.plot.fun = function() {grid.lines(1:10/10, rnorm(10, sd = .2, mean = .5))}
+ ## tip.plot.fun = function() {}
)
{
@@ -18,7 +19,6 @@
segs <- segs(phy, XXYY = xxyy$xxyy)
}
-
## TODO do these parameters even require a whole fun?
## edges <- edgechar(phy, params)
@@ -33,13 +33,13 @@
if(plot.data) {
treelayout <- grid.layout(nrow = 1, ncol = 3,
widths = unit(c(1, 1, .1), c('null', 'strwidth', 'npc'),
- list(NULL, 'seven', NULL)
+ list(NULL, phy at tip.label, NULL)
))
## TODO handle showing data and labels better
} else if(show.tip.label) {
treelayout <- grid.layout(nrow = 1, ncol = 2,
## TODO find the best way to get max label width
- widths = unit(c(1, 1), c('null', 'strwidth'), list(NULL, 'seven')))
+ widths = unit(c(1, 1), c('null', 'strwidth'), list(NULL, phy at tip.label)))
} else {treelayout = NULL}
pushViewport(viewport(
@@ -72,14 +72,14 @@
## layout = datalayout,
layout.pos.col = 3,
name = 'data_plots'))
-
+ ## TODO should plots float at tips, or only along edge?
for(i in xxyy$xxyy$yy[which(phy at edge[, 2] <= length(phy at tip.label))]) {
pushViewport(viewport(
y = i,
height = unit(1, 'snpc'),
width = unit(1, 'snpc'),
name = paste('data_plot', i),
- just = "center"))
+ just = "left"))
tip.plot.fun()
popViewport()
}
@@ -147,6 +147,8 @@
## non-root node x location
newx <- xxyy$xx[index] <- phy at edge.length[index] + prevx
}
+ ## TODO this if can be combined with the above in the else section
+ # which might be able to go in the first if
if(!is.null(index)) {
## if the x value is already set we are at a tip and we return
if(!is.na(xxyy$yy[index])) { return(xxyy) }
@@ -212,5 +214,11 @@
## How do we translate this info into a plot?
## Test code
out <- phyloXXYY(foo <- as(rcoal(3), 'phylo4'))
+data(geospiza)
+## TODO true arbitary functions with data from associated data frames
+## grid.points(
+## x = rep(1:ncol(geospiza at tip.data),
+## nrow(geospiza at tip.data))/ncol(geospiza at tip.data) - .2,
+## y = scale(geospiza at tip.data))
-treePlot(foo, plot.data = TRUE)
+treePlot(geospiza, plot.data = TRUE)
More information about the Phylobase-commits
mailing list