plot {ouch}R Documentation

ouch plotting functions

Description

Plot phylogenetic trees, with or without regime paintings.

Usage

## S4 method for signature 'ouchtree'
plot(
  x,
  ...,
  regimes = NULL,
  ladderize = TRUE,
  node.names = FALSE,
  legend = !is.null(regimes),
  labels,
  frame.plot = FALSE,
  palette = rainbow,
  margin = 0.1,
  text_opts = list(),
  legend_opts = list()
)

## S4 method for signature 'hansentree'
plot(x, ..., regimes, legend = TRUE)

Arguments

x

object to plot.

...

additional arguments, passed to plot.

regimes

factor or character; a vector of regime paintings.

ladderize

logical; should the tree be ladderized?

node.names

logical; should node names be displayed?

legend

logical; display a legend?

labels

character; taxon labels.

frame.plot

a logical indicating whether a box should be drawn around the plot.

palette

function or character; specifies the colors to be used for the several regimes on the tree. Specified as a function, when given an integer, n, the function should create a vector of n colors. See, for example rainbow. One can also specify the n colors as a vector of color codes. There must be at least as many colors as levels in the regimes.

margin

numeric; width of the right margin (as a fraction of the plot width). Adjust this if labels are clipped (see Examples below). One can also adjust the width of the left margin (for example to aid in the formatting of the figure legend). To do this, furnish margin=c(L, R), where L and R are the widths of the right and left margins, respectively, as fractions of the plot width. Obviously, in this case, we must have L+R<1.

text_opts

options for the labels; passed to text.

legend_opts

options for the the legend; passed to legend.

See Also

Other methods for ouch trees: as_data_frame, bootstrap(), coef(), logLik, ouch-package, paint(), print(), simulate(), summary(), update()

Examples

tree <- with(
  bimac,
  ouchtree(nodes=node,ancestors=ancestor,times=time,labels=spcode)
)

plot(tree)
plot(tree, node.names=TRUE)    # display node names

## When taxon names are long, they are cut off when the
## default settings are used.  For example:
tree2 <- with(
  bimac,
  ouchtree(nodes=node,ancestors=ancestor,times=time,
    labels=ifelse(is.na(species),NA,paste(species,island,sep=", "))
  )
)

plot(tree2) # long species names are cut off
## This is fixed by increasing right margin and font size:
plot(tree2,margin=0.35,text_opts=list(cex=0.7))


[Package ouch version 2.19-2 Index]