Autoplot method for multigrain_graph_optimal objects
Source: R/plot_graph_optimal.R
autoplot.multigrain_graph_optimal.RdAutoplot method for multigrain_graph_optimal objects
Arguments
- object
A
multigrain_graph_optimalobject.- ...
Additional arguments.
- root
A numeric vector indicating which nodes to be regarded as root in the tree layout. Passed down to
igraph::layout_as_tree().- digits
Number of decimal places to round to (between 0 and 3). Defaults to
NULLwhich will choose the number of digits based on how crowded the graph plot will be:a single digit if more than 8 hypotheses
2 digits if 5 to 8 hypotheses
3 digits if 4 or fewer hypotheses
- title
An optional plot title.
- x
A
multigrain_graph_optimalobject.
Value
A ggraph::ggraph() object.
Details
Both plot() and autoplot() methods require an optional dependency,
ggplot2.
Examples
library(ggplot2)
# plotting the example graph optimal
autoplot(graph_optimal_example)
# If you want to control which nodes are treated as root, you can pass them
# as a numeric vector via the `root` argument. For example, we do not like
# the default layout and we would like nodes 1 and 2 to be plotted as root:
autoplot(graph_optimal_example, root = c(1, 2))
# control the rounding with the `digits` argument.
autoplot(graph_optimal_example, root = c(1, 2), digits = 2)
# title
autoplot(graph_optimal_example, root = c(1, 2), title = "My graph optimal")