Focus on sub parts of a plot

Share:

Description

These functions can be used after barplot.phylo4d, dotplot.phylo4d and gridplot.phylo4d when tree.type is "phylogram" or "cladogram" to focus on the different part of the plot and add graphical elements.

Usage

1
2
3
4
5
6
7

Arguments

x

the trait to focus on. Can be a character string giving the name of the trait or an integer giving the number of the trait in order of appearance in the plot.

Details

#' Use focusTree to focus on the phylogenetic tree, focusTraits to focus on a given trait and focusTips to focus on the tips labels. Use focusStop to close the editing and restore graphical settings. For each part of the plot, the coordinate system is restored, making edition easier. For the phylogeny, post-editing functions of the package ape like nodelabels can be used.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require(ape)
require(phylobase)
data(navic)
dat <- tdata(navic)
neidium.sp <- c("Neidium bisulcatum",
                "Neidium affine",
                "Neidium productum")
stauroneis.sp <- c("Stauroneis kriegeri",
                   "Stauroneis acuta",
                   "Stauroneis gracilior",
                   "Stauroneis phoenicenteron")
neidium.mean <- mean(dat[neidium.sp,])
stauroneis.mean <- mean(dat[stauroneis.sp, ])

dotplot(navic, center = FALSE, scale = FALSE, data.xlim= c(0, 6))

focusTree()
nodelabels(node=c(22, 32), pch = 20, cex = 3, col = c(2, 3))

focusTraits()
segments(x0 = neidium.mean, y0 = 14.5,
         x1 = neidium.mean, y1 = 17.5,
         col = 3, lty = "dashed", lwd = 2)
segments(x0 = stauroneis.mean, y0 = 2.5,
         x1 = stauroneis.mean, y1 = 7.5,
         col = 2, lty = "dashed", lwd = 2)

focusTips()
rect(xleft = 0, ybottom = 2.5,
     xright = 0.9, ytop = 7.5,
     col = "#FF000020", border = NA)
rect(xleft = 0, ybottom = 14.5,
     xright = 0.9, ytop = 17.5,
     col = "#00FF0020", border = NA)

focusStop()

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.