From 1007197a5f9ae0ce3671be7457a38e185ac36cb4 Mon Sep 17 00:00:00 2001 From: "Liam J. Revell" Date: Wed, 18 Oct 2017 16:13:09 -0500 Subject: [PATCH] new option in plotTree.barplot --- DESCRIPTION | 8 ++++---- R/plotTree.wBars.R | 6 ++++-- man/plotTree.wBars.Rd | 6 +++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 517973d8..de6c0e66 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: phytools -Version: 0.6-30 -Date: 2017-10-03 +Version: 0.6-31 +Date: 2017-10-18 Title: Phylogenetic Tools for Comparative Biology (and Other Things) Author: Liam J. Revell Maintainer: Liam J. Revell @@ -56,6 +56,6 @@ Description: Package contains various functions for phylogenetic analysis. research. License: GPL (>= 2) URL: http://github.com/liamrevell/phytools -Packaged: 2017-10-03 12:00:00 EST +Packaged: 2017-10-18 12:00:00 EST Repository: -Date/Publication: 2017-10-03 12:00:00 EST +Date/Publication: 2017-10-18 12:00:00 EST diff --git a/R/plotTree.wBars.R b/R/plotTree.wBars.R index 2679dc01..c835b33d 100644 --- a/R/plotTree.wBars.R +++ b/R/plotTree.wBars.R @@ -52,7 +52,9 @@ plotTree.boxplot<-function(tree,x,args.plotTree=list(), ## written by Liam J. Revell 2016, 2017 plotTree.barplot<-function(tree,x,args.plotTree=list(), - args.barplot=list()){ + args.barplot=list(), ...){ + if(hasArg(add)) add<-list(...)$add + else add<-FALSE cw<-reorder(tree) if(is.data.frame(x)) x<-as.matrix(x) if(is.matrix(x)){ @@ -87,7 +89,7 @@ plotTree.barplot<-function(tree,x,args.plotTree=list(), args.plotTree$mar[3]<-args.barplot$mar[3] if(is.null(args.plotTree$ftype)) args.plotTree$ftype<-"i" if(is.null(args.plotTree$lwd)) args.plotTree$lwd<-1 - par(mfrow=c(1,2)) + if(!add) par(mfrow=c(1,2)) do.call(plotTree,args.plotTree) par(mar=args.barplot$mar) obj<-do.call(barplot,args.barplot) diff --git a/man/plotTree.wBars.Rd b/man/plotTree.wBars.Rd index 5b18dc0f..4317f276 100644 --- a/man/plotTree.wBars.Rd +++ b/man/plotTree.wBars.Rd @@ -7,8 +7,8 @@ plotTree.wBars(tree, x, scale=1, width=NULL, type="phylogram", method="plotTree", tip.labels=FALSE, col="grey", border=NULL, ...) -plotTree.barplot(tree,x,args.plotTree=list(),args.barplot=list()) -plotTree.boxplot(tree,x,args.plotTree=list(),args.boxplot=list()) +plotTree.barplot(tree, x, args.plotTree=list(), args.barplot=list(), ...) +plotTree.boxplot(tree, x, args.plotTree=list(), args.boxplot=list()) } \arguments{ \item{tree}{an object of class \code{"phylo"}.} @@ -23,7 +23,7 @@ plotTree.boxplot(tree,x,args.plotTree=list(),args.boxplot=list()) \item{args.plotTree}{in \code{plotTree.barplot}, arguments to be passed to \code{\link{plotTree}}.} \item{args.barplot}{in \code{plotTree.barplot}, arguments to be passed to \code{\link{barplot}}.} \item{args.boxplot}{in \code{plotTree.boxplot}, arguments to be passed to \code{\link{boxplot}}.} - \item{...}{optional arguments to be passed to \code{\link{plotTree}} or \code{\link{plotSimmap}}.} + \item{...}{optional arguments to be passed to \code{\link{plotTree}} or \code{\link{plotSimmap}} in the case of \code{plotTree.wBars}. For \code{plotTree.barplot}, the only optional argument is \code{add}. Generally this should not be used; however it can be used to tell the function to draw the tree & barplot, respectively, in the next two open plotting devices - rather than creating a table of figures in the current plotting device.} } \description{ \code{plotTree.wbars} plots a phylogeny in phylogram or fan style with bars at the tips representing the values for a phenotypic trait.