Learn R Programming

ggpedigree

ggpedigree provides modern tools for visualizing pedigree structures using both ‘ggplot2’ and ‘plotly’. It is designed to work seamlessly with the BGmisc package for simulated or empirical pedigree data, and extends the plotting capabilities of the base-graphics functions in kinship2.

The package supports:

  • Static, publication-ready pedigree plots using the ggplot2 framework

  • Interactive pedigree visualizations using plotly

  • Layout customization, complex mating structures, and duplicated individuals

ggpedigree is useful in behavior genetics, kinship analysis, and any research involving complex pedigree data.

Installation

You can install the released version of ggpedigree from CRAN with:

install.packages("ggpedigree")

To install the development version of ggpedigree from GitHub use:

# install.packages("devtools")
devtools::install_github("R-Computing-Lab/ggpedigree")

Demonstration

Here is a basic example of how to use ggpedigree to visualize a pedigree structure. The potter dataset contains simulated pedigree data for the Weasley family from the Harry Potter series.

ggPedigree(potter,
  famID = "famID",
  personID = "personID"
)

Citation

If you use ggpedigree in your research or wish to refer to it, please cite the following:

citation(package = "ggpedigree")

Garrison S (2025). ggpedigree: Visualizing Pedigrees with ‘ggplot2’ and ‘plotly’. R package version 0.8.0, https://github.com/R-Computing-Lab/ggpedigree/.

A BibTeX entry for LaTeX users is

@Manual{,
  title = {ggpedigree: Visualizing Pedigrees with 'ggplot2' and 'plotly'},
  author = {S. Mason Garrison},
  year = {2025},
  note = {R package version 0.8.0},
  url = {https://github.com/R-Computing-Lab/ggpedigree/},
}

Contributing

Contributions to the ggpedigree project are welcome. For guidelines on how to contribute, please refer to the Contributing Guidelines. Issues and pull requests should be submitted on the GitHub repository. For support, please use the GitHub issues page.

Branching and Versioning System

The development of ggpedigree follows a GitFlow branching strategy:

  • Feature Branches: All major changes and new features should be developed on separate branches created from the dev branch. Name these branches according to the feature or change they are meant to address.
  • Development Branch: The dev branch is the main development branch where all feature branches are merged. This branch contains the latest changes and is used for testing and development purposes.
  • Main Branch (main): The main branch mirrors the stable state of the project as seen on CRAN. Only fully tested and approved changes from the dev branch are merged into main to prepare for a new release.

License

ggpedigree is licensed under the GNU General Public License v3.0. For more details, see the LICENSE.md file.

Copy Link

Version

Install

install.packages('ggpedigree')

Version

0.8.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

S. Mason Garrison

Last Published

July 4th, 2025

Functions in ggpedigree (0.8.0)

generateSpouseList

Generate a spouselist matrix
.restoreNames

Restore Names in Connections Data Frame
computeDistance

Compute distance between two points
.addScales

Add Scales to ggplot Pedigree Plot
.addOverlay

Add Overlay to ggplot Pedigree Plot
.addSelfSegment

Add Self Segments to ggplot Pedigree Plot
calculateConnections

Calculate connections for a pedigree dataset
.addNodes

Add Nodes to ggplot Pedigree Plot
.addLabels

Add Labels to ggplot Pedigree Plot
buildSpouseSegments

Build spouse segments
ggPedigreeInteractive

Interactive pedigree plot (Plotly wrapper around ggPedigree)
.adjustSpacing

Adjust Spacing in ggPedigree Data
getRelativeCoordinates

Get coordinate positions of relatives for each individual
ggPedigree.core

Core Function for ggPedigree
getDefaultPlotConfig

Shared Default Plotting Configuration
ggPhenotypeByDegree

Plot correlation of genetic relatedness by phenotype
getMidpoints

Compute midpoints across grouped coordinates
ggPhenotypeByDegree.core

Core plotting function for ggPhenotypeByDegree This function generates the core ggplot object based on the prepared data frame.
plotPedigree

plotPedigree A wrapped function to plot simulated pedigree from function simulatePedigree. This function require the installation of package kinship2.
ggRelatednessMatrix

Plot a relatedness matrix as a heatmap (ggpedigree style)
ggRelatednessMatrix.core

Core Function for ggRelatednessMatrix
processExtras

Process duplicate appearances of individuals in a pedigree layout
tooltip_fmt

Format tooltip text
ggPedigree

Plot a custom pedigree diagram
redsquirrels

Kluane Red Squirrel Data
makeSymmetricKey

Generate a symmetric key for two IDs
ggpedigree-package

ggpedigree: Visualizing Pedigrees with 'ggplot2' and 'plotly'
buildPlotConfig

build Config
calculateCoordinates

Calculate coordinates for plotting individuals in a pedigree
countSiblings

Count siblings of each individual
countOffspring

Count offspring of each individual
ASOIAF

A pedigree of ice and fire
createFillColumn

Get fill column for ggPedigree
.addAnnotate

Add annotates to ggplot Pedigree Plot
.preparePhenotypeByDegreeData

Prepare data for ggPhenotypeByDegree This function prepares the data frame for plotting by calculating necessary columns and ensuring required columns are present.
.computeCurvedMidpoint

Compute midpoint coordinate for curved segment