ggdendro

Tools to extract dendrogram plot data for use with 'ggplot2'

https://github.com/andrie/ggdendro

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (21.4%) to scientific vocabulary

Keywords

ggplot2 r r-package r-stats
Last synced: 6 months ago · JSON representation

Repository

Tools to extract dendrogram plot data for use with 'ggplot2'

Basic Info
Statistics
  • Stars: 86
  • Watchers: 8
  • Forks: 12
  • Open Issues: 4
  • Releases: 6
Topics
ggplot2 r r-package r-stats
Created over 14 years ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog

README.Rmd

---
output: github_document
format: gfm
default-image-extension: ""
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

# ggdendro 


Provides functions for creating dendrograms and tree plots using `ggplot2`.



[![CRAN status](https://www.r-pkg.org/badges/version/ggdendro)](https://CRAN.R-project.org/package=ggdendro)
[![CRAN RStudio mirror downloads](http://cranlogs.r-pkg.org/badges/ggdendro)](http://www.r-pkg.org/pkg/ggdendro)
[![R-CMD-check](https://github.com/andrie/ggdendro/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/andrie/ggdendro/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/andrie/ggdendro/branch/main/graph/badge.svg)](https://app.codecov.io/gh/andrie/ggdendro?branch=main)
[![Project Status: Inactive – The project has reached a stable, usable state but is no longer being actively developed; support/maintenance will be provided as time allows.](https://www.repostatus.org/badges/latest/inactive.svg)](https://www.repostatus.org/#inactive)





The `ggdendro` package offers a generic function to extract data and text from the various clustering models:

* `dendro_data()` extracts cluster information from the model object, e.g. cluster allocation, line segment data or label data.

The `dendro_data` object has methods for the following classes:

* `tree`
* `hclust`
* `dendrogram`
* `rpart`

These methods create an object of class `dendro`, which is essentially a list of data frames.  To extract the relevant data frames from the list, use the three accessor functions:

* `segment()` for the line segment data
* `label()` for the text for each end segment
* `leaf_label()` for the leaf labels of a tree diagram


The results of these functions can then be passed to `ggplot()` for plotting.

## Examples

```{r}
library(ggplot2)
library(ggdendro)
hc <- hclust(dist(USArrests), "ave")
hcdata <- dendro_data(hc, type = "rectangle")
ggplot() +
  geom_segment(data = segment(hcdata), 
               aes(x = x, y = y, xend = xend, yend = yend)
  ) +
  geom_text(data = label(hcdata), 
            aes(x = x, y = y, label = label, hjust = 0), 
            size = 3
  ) +
  coord_flip() +
  scale_y_reverse(expand = c(0.2, 0))

### demonstrate plotting directly from object class hclust
ggdendrogram(hc)
ggdendrogram(hc, rotate = TRUE)

### demonstrate converting hclust to dendro using dendro_data first
hcdata <- dendro_data(hc)
ggdendrogram(hcdata, rotate = TRUE) +
  labs(title = "Dendrogram in ggplot2")
```
	    
# Use `dendextend` instead

Most of the functionality in `ggdendro` is included in the excellent `dendextend` package.  In most cases, if you need additional functionality, please use the `dendextend` package instead.

The `ggdendro` package will only get minimal maintenance in future.

Refer to 

Owner

  • Name: Andrie de Vries
  • Login: andrie
  • Kind: user
  • Location: London, United Kingdom
  • Company: @posit

Director of product strategy at @Posit, helping to make R and Python first class citizens for data science and enterprise deployment.

GitHub Events

Total
  • Watch event: 3
  • Issue comment event: 1
  • Push event: 2
  • Fork event: 1
Last Year
  • Watch event: 3
  • Issue comment event: 1
  • Push event: 2
  • Fork event: 1

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 139
  • Total Committers: 4
  • Avg Commits per committer: 34.75
  • Development Distribution Score (DDS): 0.158
Past Year
  • Commits: 1
  • Committers: 1
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Andrie de Vries a****s@g****m 117
andrie.de.vries a****s@p****m 20
Jason Daniel Augustine Gilliland j****d@g****m 1
Artem A. Klevtsov a****v@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 30
  • Total pull requests: 6
  • Average time to close issues: about 1 year
  • Average time to close pull requests: about 1 month
  • Total issue authors: 21
  • Total pull request authors: 5
  • Average comments per issue: 2.83
  • Average comments per pull request: 0.83
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • andrie (9)
  • jernest1 (2)
  • thomasp85 (1)
  • GuptaPriyanshu (1)
  • kassambara (1)
  • rhart604 (1)
  • fawda123 (1)
  • trinker (1)
  • jrijn (1)
  • theclue (1)
  • mmaga (1)
  • artemklevtsov (1)
  • lpfgarcia (1)
  • hadley (1)
  • Queex (1)
Pull Request Authors
  • andrie (2)
  • chr1swallace (1)
  • jdagilliland (1)
  • artemklevtsov (1)
  • MichaelChirico (1)
Top Labels
Issue Labels
Bug (6) Enhancement (4) Question (2)
Pull Request Labels
Enhancement (2)

Packages

  • Total packages: 3
  • Total downloads:
    • cran 12,576 last-month
  • Total docker downloads: 152,878
  • Total dependent packages: 47
    (may contain duplicates)
  • Total dependent repositories: 167
    (may contain duplicates)
  • Total versions: 17
  • Total maintainers: 1
proxy.golang.org: github.com/andrie/ggdendro
  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.5%
Dependent repos count: 5.7%
Last synced: 6 months ago
cran.r-project.org: ggdendro

Create Dendrograms and Tree Diagrams Using 'ggplot2'

  • Versions: 10
  • Dependent Packages: 42
  • Dependent Repositories: 163
  • Downloads: 12,576 Last month
  • Docker Downloads: 152,878
Rankings
Dependent repos count: 1.5%
Dependent packages count: 1.9%
Downloads: 3.8%
Stargazers count: 4.8%
Forks count: 6.3%
Average: 6.4%
Docker downloads count: 20.2%
Maintainers (1)
Last synced: 6 months ago
conda-forge.org: r-ggdendro
  • Versions: 4
  • Dependent Packages: 5
  • Dependent Repositories: 4
Rankings
Dependent packages count: 10.4%
Dependent repos count: 16.1%
Average: 26.9%
Stargazers count: 36.1%
Forks count: 44.9%
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • MASS * imports
  • ggplot2 >= 0.9.2 imports
  • cluster * suggests
  • knitr * suggests
  • rmarkdown * suggests
  • rpart >= 4.0 suggests
  • scales * suggests
  • spelling * suggests
  • testthat * suggests
  • tree * suggests