corner_coords: Get the corner coordinates

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/BioGeoBEARS_plots_v1.R

Description

Gets the coordinates of the corners when the tree is plotted.

Usage

1
2
  corner_coords(tr, coords_fun = "plot_phylo3_nodecoords",
    tmplocation = "manual")

Arguments

tr

A tree object in phylo format.

coords_fun

The name of the function to use to get node coordinates. Default: "plot_phylo3_nodecoords".

tmplocation

Default is "manual", which throws an error check unless your path structure matches the developer's. Most users should probably use the system.file command in the examples, below. The directory location containing the R script plot_phylo3_nodecoords.R. This function, modified from the ape function plot.phylo, cannot be included directly in the R package as it contains C code that does not pass CRAN's R CMD check. The default, cornercoords_loc="manual", will not allow split states to be plot. The R script plot_phylo3_nodecoords.R is located in the BioGeoBEARS extension data directory, extdata/a_scripts. You should be able to get the full path with list.files(system.file("extdata/a_scripts", package="BioGeoBEARS"), full.names=TRUE).

Details

Because this function needs to use a modified version of the APE plot.phylo function, and for complex reasons APE's .C functions cannot be used elsewhere without causing problems with R CMD check, this function is left up to user specification. Basically, the user puts in the name of the function, which is available in the extension data (extdata/a_scripts) directory of the package. The defaults work on the developer's machine, other users may have to e.g. change "manual" to tmplocation, where tmplocation is specified as in the example.

Value

corners_list

Note

Go BEARS!

Author(s)

Nicholas J. Matzke matzke@berkeley.edu

References

http://phylo.wikidot.com/matzke-2013-international-biogeography-society-poster

Matzke_2012_IBS

See Also

phylo, get_nodenums

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Set location like this if you don't have plot_phylo3_nodecoords
# hardcoded/sourced elsehwhere
# tmplocation = np(system.file("extdata/a_scripts", package="BioGeoBEARS"))
#
## Not run: 
extdata_dir = np(system.file("extdata", package="BioGeoBEARS"))
trfn = np(paste(extdata_dir, "/Psychotria_5.2.newick", sep=""))
tr = read.tree(trfn)
tmplocation = np(system.file("extdata/a_scripts", package="BioGeoBEARS"))
corner_coords(tr, coords_fun="plot_phylo3_nodecoords", tmplocation=tmplocation)

## End(Not run)

Example output

Loading required package: rexpokit
Loading required package: cladoRcpp
Loading required package: ape
Loading required package: phylobase

Attaching package: 'phylobase'

The following object is masked from 'package:ape':

    edges

$leftcorns
   node        x       y
20   20 0.000000 18.2500
21   21 0.287312 15.5000
22   22 1.021831 13.0625
23   23 2.711001  8.5000
24   24 3.013350  7.0000
25   25 3.348088  5.5000
26   26 3.524799  3.5000
27   27 4.233425  2.0000
28   28 3.968892  4.0000
29   29 3.348978  6.0000
30   30 4.067747  9.0000
31   31 1.754748 14.0000
32   32 2.214856 13.0000
33   33 2.472271 12.0000
34   34 3.205099 11.0000
35   35 2.719810 16.0000
36   36 2.372081 19.0000
37   37 2.835126 18.0000

$rightcorns
   node        x        y
20   20 0.000000 12.76562
21   21 0.287312 10.03125
22   22 1.021831  7.00000
23   23 2.711001  5.50000
24   24 3.013350  4.00000
25   25 3.348088  2.50000
26   26 3.524799  1.50000
27   27 4.233425  1.00000
28   28 3.968892  3.00000
29   29 3.348978  5.00000
30   30 4.067747  8.00000
31   31 1.754748 12.12500
32   32 2.214856 11.25000
33   33 2.472271 10.50000
34   34 3.205099 10.00000
35   35 2.719810 15.00000
36   36 2.372081 17.50000
37   37 2.835126 17.00000

BioGeoBEARS documentation built on May 29, 2017, 8:36 p.m.