Learn R Programming

ggenealogy (version 1.0.3)

plotPath: Construct the graphic object of the path

Description

This function takes the path as input and outputs an ggplot2 object. The image will correctly position the node labels with x-axis representing the node date, and y-axis representing the node path index. Edges between two nodes represent parent-child relationships between those nodes. For visual appeal, there is a grey box that outlines the node label, as well as an underline and overline for each label.

Usage

plotPath(path, geneal, colName, colNameY = "", fontFace = 1)

Arguments

path

object created from function getPath

geneal

the full genealogy (in data frame format)

colName

the name of the column of the data frame that contains the quantitative variable of interest (in character string format)

colNameY

the name of the second optional column of the data frame that contains the second optional quantitative variable of interest (in character string format). This optional quantitative variable will be plotted on the vertical axis.

fontFace

fontface for the two nodes of interest (1=plain, 2=bold, 3=italic, 4=bold-italic), DEFAULT is 1

References

Rutter L, VanderPlas S, Cook D, Graham MA (2019). ggenealogy: An R Package for Visualizing Genealogical Data. Journal of Statistical Software, 89(13), 1--31. tools:::Rd_expr_doi("10.18637/jss.v089.i13")

See Also

getPath for information on input path building

Examples

Run this code
data(sbGeneal)
ig <- dfToIG(sbGeneal)
pathTN <- getPath("Tokyo", "Narow", sbIG, sbGeneal, "devYear")
plotPath(pathTN, sbGeneal, "devYear")

sbFilt <- sbGeneal[complete.cases(sbGeneal[1:3]),]
sbFiltIG <- dfToIG(sbFilt)
pathCL <- getPath("Clark", "Lawrence", sbFiltIG, sbFilt, "yield")
plotPath(pathCL, sbFilt, "devYear", "yield") + ggplot2::xlab("Dev Year") + ggplot2::ylab("Yield")

Run the code above in your browser using DataLab