plot_grviz {maths.genealogy} | R Documentation |
Plot genealogical tree with Graphviz
Description
Plots a genealogical tree either interactively or to PDF using the Graphviz layout engine.
Usage
plot_grviz(g, file = "", max_zoom = 200)
Arguments
g |
an object of class |
file |
an optional file name. If the file name is specified, then Graphviz will render the genealogical tree to PDF and save in this file. If the file name is not specified, then the plot will be rendered interactively in the RStudio Viewer panel. |
max_zoom |
a |
Details
This function requires the DiagrammeR
, DiagrammeRsvg
and either svgPanZoom
(interactive) or rsvg
(pdf output) packages to be installed.
They are only "Suggests" dependencies as this package supports multiple plotting options.
The presence of these packages will be verified when the function is actually called, providing an opportunity to install them automatically if needed.
Value
If a filename was specified, the full path of the saved file is returned as a character(1)
string.
If no filename was specified, then an htmlwidget
suitable for display in the RStudio Viewer is returned.
References
Ellson, J., Gansner, E.R., Koutsofios, E., North, S.C. and Woodhull, G. (2004). “Graphviz and Dynagraph — Static and Dynamic Graph Drawing Tools”. In: Jünger, M., Mutzel, P. (eds) Graph Drawing Software, Mathematics and Visualization, 127-148. doi:10.1007/978-3-642-18638-7_6.
Iannone, R. and Roy, O. (2024). DiagrammeR: Graph/Network Visualization. R package, https://CRAN.R-project.org/package=DiagrammeR.
Iannone, R. (2016). DiagrammeRsvg: Export DiagrammeR Graphviz Graphs as SVG. R package, https://CRAN.R-project.org/package=DiagrammeRsvg.
Ooms, J. (2024). rsvg: Render SVG Images into PDF, PNG, (Encapsulated) PostScript, or Bitmap Arrays. R package, https://CRAN.R-project.org/package=rsvg.
Riutta, A., Tangelder, J., Russell, K., et al. (2020). svgPanZoom: R 'Htmlwidget' to Add Pan and Zoom to Almost any R Graphic. R package, https://CRAN.R-project.org/package=svgPanZoom.
Examples
# First, you need to use search_id() to find the mathematician ID for the
# individual(s) you wish to plot, or visit https://mathgenealogy.org/ to look
# up in the browser.
# Don't test these as rely on internet resources that can be temporarily
# unavailable.
# For example, the package author would get their own tree using
g <- get_genealogy(171971)
# Then use the plot_grviz() function to produce a full genealogical tree
plot_grviz(g)