{"id":13788517,"url":"https://github.com/andrie/ggdendro","last_synced_at":"2025-04-07T05:15:14.103Z","repository":{"id":56934086,"uuid":"2166358","full_name":"andrie/ggdendro","owner":"andrie","description":"Tools to extract dendrogram plot data for use with 'ggplot2'","archived":false,"fork":false,"pushed_at":"2024-03-31T17:29:23.000Z","size":11769,"stargazers_count":81,"open_issues_count":3,"forks_count":11,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-05-18T20:48:34.946Z","etag":null,"topics":["ggplot2","r","r-package","r-stats"],"latest_commit_sha":null,"homepage":"http://andrie.github.io/ggdendro/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andrie.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-08-06T20:35:39.000Z","updated_at":"2024-06-19T01:33:34.688Z","dependencies_parsed_at":"2022-08-21T06:50:37.634Z","dependency_job_id":"ae0283af-aaf2-4c03-8b73-5b3cb3d797d5","html_url":"https://github.com/andrie/ggdendro","commit_stats":{"total_commits":132,"total_committers":4,"mean_commits":33.0,"dds":"0.16666666666666663","last_synced_commit":"b464653f6ac8d7e73acae360c605e9e80cdaf008"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrie%2Fggdendro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrie%2Fggdendro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrie%2Fggdendro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrie%2Fggdendro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrie","download_url":"https://codeload.github.com/andrie/ggdendro/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247595335,"owners_count":20963943,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ggplot2","r","r-package","r-stats"],"created_at":"2024-08-03T21:00:49.006Z","updated_at":"2025-04-07T05:15:14.073Z","avatar_url":"https://github.com/andrie.png","language":"R","funding_links":[],"categories":["R","パッケージ紹介","ggplot"],"sub_categories":["ggdendro","Additional Plot Types"],"readme":"---\noutput: github_document\nformat: gfm\ndefault-image-extension: \"\"\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# ggdendro \u003cimg src='man/figures/logo.png' align=\"right\" height=\"139\" /\u003e\n\n\nProvides functions for creating dendrograms and tree plots using `ggplot2`.\n\n\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/ggdendro)](https://CRAN.R-project.org/package=ggdendro)\n[![CRAN RStudio mirror downloads](http://cranlogs.r-pkg.org/badges/ggdendro)](http://www.r-pkg.org/pkg/ggdendro)\n[![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)\n[![Codecov test coverage](https://codecov.io/gh/andrie/ggdendro/branch/main/graph/badge.svg)](https://app.codecov.io/gh/andrie/ggdendro?branch=main)\n[![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)\n\u003c!-- badges: end --\u003e\n\n\n\n\nThe `ggdendro` package offers a generic function to extract data and text from the various clustering models:\n\n* `dendro_data()` extracts cluster information from the model object, e.g. cluster allocation, line segment data or label data.\n\nThe `dendro_data` object has methods for the following classes:\n\n* `tree`\n* `hclust`\n* `dendrogram`\n* `rpart`\n\nThese 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:\n\n* `segment()` for the line segment data\n* `label()` for the text for each end segment\n* `leaf_label()` for the leaf labels of a tree diagram\n\n\nThe results of these functions can then be passed to `ggplot()` for plotting.\n\n## Examples\n\n```{r}\nlibrary(ggplot2)\nlibrary(ggdendro)\nhc \u003c- hclust(dist(USArrests), \"ave\")\nhcdata \u003c- dendro_data(hc, type = \"rectangle\")\nggplot() +\n  geom_segment(data = segment(hcdata), \n               aes(x = x, y = y, xend = xend, yend = yend)\n  ) +\n  geom_text(data = label(hcdata), \n            aes(x = x, y = y, label = label, hjust = 0), \n            size = 3\n  ) +\n  coord_flip() +\n  scale_y_reverse(expand = c(0.2, 0))\n\n### demonstrate plotting directly from object class hclust\nggdendrogram(hc)\nggdendrogram(hc, rotate = TRUE)\n\n### demonstrate converting hclust to dendro using dendro_data first\nhcdata \u003c- dendro_data(hc)\nggdendrogram(hcdata, rotate = TRUE) +\n  labs(title = \"Dendrogram in ggplot2\")\n```\n\t    \n# Use `dendextend` instead\n\nMost 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.\n\nThe `ggdendro` package will only get minimal maintenance in future.\n\nRefer to \u003chttps://cran.r-project.org/web/packages/dendextend/index.html\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrie%2Fggdendro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrie%2Fggdendro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrie%2Fggdendro/lists"}