{"id":13711486,"url":"https://github.com/great-northern-diver/ggmulti","last_synced_at":"2025-12-27T08:50:37.678Z","repository":{"id":46031204,"uuid":"318817598","full_name":"great-northern-diver/ggmulti","owner":"great-northern-diver","description":"Package for adding some multivariate visualizations to ggplot2","archived":false,"fork":false,"pushed_at":"2023-12-13T16:48:48.000Z","size":85289,"stargazers_count":12,"open_issues_count":2,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-08-03T23:23:33.537Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/great-northern-diver.png","metadata":{"files":{"readme":"README.md","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}},"created_at":"2020-12-05T15:08:33.000Z","updated_at":"2024-01-31T08:53:04.000Z","dependencies_parsed_at":"2024-01-17T16:57:19.413Z","dependency_job_id":"6b7a9e6f-e5fd-4a1f-9927-9073bae46f9a","html_url":"https://github.com/great-northern-diver/ggmulti","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/great-northern-diver%2Fggmulti","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/great-northern-diver%2Fggmulti/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/great-northern-diver%2Fggmulti/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/great-northern-diver%2Fggmulti/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/great-northern-diver","download_url":"https://codeload.github.com/great-northern-diver/ggmulti/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224535241,"owners_count":17327503,"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":[],"created_at":"2024-08-02T23:01:08.763Z","updated_at":"2025-12-27T08:50:37.671Z","avatar_url":"https://github.com/great-northern-diver.png","language":"R","funding_links":[],"categories":["Plot layers"],"sub_categories":[],"readme":"# ggmulti \n\n[![Build Status](https://travis-ci.com/great-northern-diver/ggmulti.svg?branch=main)](https://travis-ci.com/great-northern-diver/ggmulti.svg?branch=main)\n[![Codecov test coverage](https://codecov.io/gh/great-northern-diver/ggmulti/branch/main/graph/badge.svg)](https://codecov.io/gh/great-northern-diver/ggmulti?branch=main)\n[![CRAN status](https://www.r-pkg.org/badges/version/ggmulti)](https://cran.r-project.org/web/packages/ggmulti/index.html)\n![R-CMD-check](https://github.com/great-northern-diver/ggmulti/workflows/R-CMD-check/badge.svg)\n\n\u003cimg src=\"man/figures/logo.png\" align=\"right\" width=\"120\" /\u003e\nIt provides materials (i.e. serialaxes objects) to visualize high dimensional data in `ggplot`.\n\nDocumentation: https://great-northern-diver.github.io/ggmulti/\n\n## Introduction\n\nPackage `ggmulti` extends the `ggplot2`  package to provide some high dimensional visualization functionality, such as\n\n* Serialaxes coordinates (i.e., parallel or  radial axis systems)\n\n* General glyphs (e.g., polygons, images) to appear a scatterplot. \n\n* \"More general\" `geom_histogram` and `geom_density` to allow them to appear on serial axes.\n\n### Serialaxes Coordinates\n\nParallel coordinates\n\n```\nlibrary(ggmulti)\np \u003c- ggplot(iris, \n            mapping = aes(Sepal.Length = Sepal.Length,\n                          Sepal.Width = Sepal.Width,\n                          Petal.Length = Petal.Length,\n                          Petal.Width = Petal.Width,\n                          colour = Species)) +\n       geom_path(alpha = 0.2) +\n       coord_serialaxes(scaling = 'variable')\np\n```\n\n![](man/figures/parallel.png)\n\nWe can also construct a radar plot by setting `axes.layout = \"radial\"` in `coord_serialaxes`. In addition, we can add histogram layer on top\n\n```\np + \n  geom_histogram(mapping = aes(fill = Species), alpha = 0.5)\n```\n\n![](man/figures/parallel_hist.png)\n\n### Glyphs\n\nThe flag of Canada\n\n```{r}\ncanada \u003c- data.frame(\n  xmin = c(-2, -1, 1),\n  xmax = c(-1, 1, 2),\n  ymin = rep(-1.2, 3),\n  ymax = rep(1.2, 3),\n  fill = factor(c(1,2,1))\n)\n\np \u003c- ggplot() + \n  geom_rect(data = canada, \n            mapping = aes(xmin = xmin, xmax = xmax, \n                          ymin = ymin, ymax = ymax,\n                          fill = fill),\n            colour = \"black\") + \n  geom_polygon_glyph(data = data.frame(x = 0, y = 0), \n                     mapping = aes(x = x, y = y),\n                     polygon_x = x_maple,\n                     polygon_y = y_maple, \n                     fill = \"red\",\n                     size = 2) + \n  scale_fill_manual(values = c(\"red\", \"white\")) + \n  theme_void() + \n  theme(legend.position = \"none\")\np\n```\n\n![](man/figures/canada.png)\n\nWe can save it as a `png` object, then call `geom_image_glyph` to display the image glyph\n\n```\nggsave(\"canada.png\", type = \"cairo\", bg = \"white\")\nimages \u003c- png::readPNG(\"canada.png\")\nggplot(data = data.frame(x = c(1,2,1.5,2,1), y = c(1,1,1.5,2,2)),\n       mapping = aes(x = x, y = y)) +\n       geom_image_glyph(images = rep(list(images), 5)) + \n       coord_cartesian(xlim = extendrange(c(1,2)),\n                       ylim = extendrange(c(1,2)))\n```\n\n![](man/figures/canada5.png)\n\n### \"More general\" `geom_histogram` and `geom_density`\n\nFunctions `geom_histogram_` and `geom_density_` are more general `geom_histogram` and `geom_density` since these two functions can accommodate both `x` and `y` simutaniously. If only one is provided, `geom_histogram` or `geom_density` will be executed.\n\nThe following figure displays the back to back plot (histogram and density)\n\n```\niris %\u003e%\n  tidyr::pivot_longer(cols = -Species,\n                      names_to = \"Outer sterile whorls\",\n                      values_to = \"values\") %\u003e%\n  ggplot(mapping = aes(x = `Outer sterile whorls`,\n                       y = values, \n                       fill = Species)) +\n  geom_histogram_(scale.y = \"group\",\n                  alpha = 0.5,\n                  prop = 0.6) + \n  geom_density_(scale.y = \"group\",\n                prop = 0.6,\n                alpha = 0.5,\n                colour = NA,\n                positive = FALSE)\n```\n\n![](man/figures/hist_density.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreat-northern-diver%2Fggmulti","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgreat-northern-diver%2Fggmulti","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreat-northern-diver%2Fggmulti/lists"}