View source: R/2-plot-functions.R
plot.sevt | R Documentation |
Plot method for staged event tree objects. It allows easy plotting of staged event trees with some options (see Examples).
## S3 method for class 'sevt' plot( x, y = 10, limit = y, xlim = c(0, 1), ylim = c(0, 1), main = NULL, sub = NULL, asp = 1, cex_label_nodes = 0, cex_label_edges = 1, cex_nodes = 2, cex_tree_y = 0.9, col = NULL, col_edges = "black", var_names = TRUE, ignore = x$name_unobserved, pch_nodes = 16, lwd_nodes = 1, lwd_edges = 1, ... ) make_stages_col(x, col = NULL, ignore = x$name_unobserved, limit = NULL)
x |
an object of class |
y |
alias for |
limit |
maximum number of variables plotted. |
xlim |
the x limits (x1, x2) of the plot. |
ylim |
the y limits of the plot. |
main |
an overall title for the plot. |
sub |
a sub title for the plot. |
asp |
the y/x aspect ratio. |
cex_label_nodes |
the magnification to be used for
the node labels.
If set to |
cex_label_edges |
the magnification
for the edge labels.
If set to |
cex_nodes |
the magnification for the nodes of the tree. |
cex_tree_y |
the magnification for the
tree in the vertical direction.
Default is |
col |
color mapping for stages, one of the following:
NULL (color will be assigned based on the current palette);
a named (variables) list of named (stages)
vectors of colors;
the character |
col_edges |
color for the edges. |
var_names |
logical, if variable names should be added to the plot,
otherwise variable names can be added manually using
|
ignore |
vector of stages which will be ignored and left untouched,
by default the name of the unobserved stages stored in
|
pch_nodes |
either an integer specifying a symbol or a single character
to be used as the default in plotting nodes shapes see
|
lwd_nodes |
the line width for edges, a positive number, defaulting to 1. |
lwd_edges |
the line width for nodes, a positive number, defaulting to 1. |
... |
additional graphical parameters to be passed to
|
data("PhDArticles") mod <- stages_bj(full(PhDArticles, join_unobserved = TRUE)) ### simple plotting plot(mod) ### labels in nodes plot(mod, cex_label_nodes = 1, cex_nodes = 0) ### reduce nodes size plot(mod, cex_nodes = 0.5) ### change line width and nodes style plot(mod, lwd_edges = 3, pch_nodes = 5) ### changing palette plot(mod, col = function(s) heat.colors(length(s))) ### or changing global palette palette(hcl.colors(10, "Harmonic")) plot(mod) palette("default") ## ### forcing plotting of unobserved stages plot(mod, ignore = NULL) ### use function to specify colors plot(mod, col = function(stages){ hcl.colors(n = length(stages)) }) ### manually give stages colors ### as an example we will assign colors only to the stages of two variables ### Gender (one stage named "1") and Mentor (six stages) col <- list(Gender = c("1" = "blue"), Mentor = c("UNOBSERVED" = "grey", "2" = "red", "3" = "purple", "10" = "pink", "18" = "green", "22" = "brown")) ### by setting ignore = NULL we will plot also the UNOBSERVED stage for Mentor plot(mod, col = col, ignore = NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.