Main function
The main function to use is phyr::pglmm.plot.re()
(alias: phyr::communityPGLMM.show.re()
, phyr::communityPGLMM.plot.re()
). Here are the arguments of this function:
args(phyr::pglmm.plot.re)
## function (formula = NULL, data = NULL, family = "gaussian", sp.var = "sp",
## site.var = "site", tree = NULL, tree_site = NULL, repulsion = FALSE,
## x = NULL, show.image = TRUE, show.sim.image = FALSE, random.effects = NULL,
## add.tree.sp = TRUE, add.tree.site = FALSE, cov_ranef = NULL,
## tree.panel.space = 0.5, title.space = 5, tree.size = 3, ...)
## NULL
Some brief explanation of arguments:
x
: a model with class communityPGLMM, if it is specified, then all other argument before x will be ignored.show.image
(TRUE
orFALSE
): whether to plot the var-cov matrix of random terms?show.sim.image
(TRUE
orFALSE
): whether to plot simulated site by species matrix for all random terms?add.tree.sp
(TRUE
orFALSE
): whenshow.sim.image = TRUE
, whether to add a phylogeny of species at the top of each matrix plot?add.tree.site
(TRUE
orFALSE
): whenshow.sim.image = TRUE
, whether to add a phylogeny of sites at the right of each matrix plot? This can be useful for bipartite problems (e.g. pollinators (species) and plants (sites)).tree.size
(default is 3): the height of the phylogenies to plot, unit is number of lines.
This function will return a hidden list, which includes all the var-cov matrices of random terms, simulated site by species matrices, individual plots, and all plots in one figure for both var-cov matrices and simulated ones. Therefore, we can extract specific plots and then update them or generate new figure with gridExtra::grid.arrange()
. This is because all generated plots are based on lattice
package and are all grid
object. Therefore, we can also use gridExtra::arrangeGrob()
to put multiple plots in one figure and then use ggplot2::ggsave()
to save it as external file (e.g. PDF). Of course, pdf()
and dev.off()
will also work.