{"id":13401344,"url":"https://github.com/lionel-/ggstance","last_synced_at":"2025-04-04T08:05:22.210Z","repository":{"id":56935368,"uuid":"50201421","full_name":"lionel-/ggstance","owner":"lionel-","description":"Horizontal ggplot2 components","archived":false,"fork":false,"pushed_at":"2024-05-20T04:40:11.000Z","size":2005,"stargazers_count":201,"open_issues_count":6,"forks_count":19,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-03-28T07:02:39.702Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/lionel-.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-01-22T19:04:00.000Z","updated_at":"2024-05-20T04:37:03.000Z","dependencies_parsed_at":"2023-01-22T06:16:20.754Z","dependency_job_id":"24c0e7da-a087-4af1-8bf0-c21ad2557138","html_url":"https://github.com/lionel-/ggstance","commit_stats":{"total_commits":141,"total_committers":9,"mean_commits":"15.666666666666666","dds":0.06382978723404253,"last_synced_commit":"7e303d755624d3764d4543a18c9abdbd410e2767"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lionel-%2Fggstance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lionel-%2Fggstance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lionel-%2Fggstance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lionel-%2Fggstance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lionel-","download_url":"https://codeload.github.com/lionel-/ggstance/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247137391,"owners_count":20889867,"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-07-30T19:01:01.775Z","updated_at":"2025-04-04T08:05:22.192Z","avatar_url":"https://github.com/lionel-.png","language":"R","funding_links":[],"categories":["R","Plot layers","Table of Contents","ggplot"],"sub_categories":["Visualization","Additional Plot Types"],"readme":"\n\u003c!-- badges: start --\u003e\n[![Lifecycle: superseded](https://img.shields.io/badge/lifecycle-superseded-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html)\n[![R-CMD-check](https://github.com/lionel-/ggstance/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/lionel-/ggstance/actions/workflows/R-CMD-check.yaml)\n\u003c!-- badges: end --\u003e\n\n# ggstance\n\n**Important**: This package has been superseded by [ggplot2 3.3.0](https://www.tidyverse.org/blog/2020/03/ggplot2-3-3-0/), which now has full native support for horizontality. The ggstance package will continue to be maintained for some time, but please consider switching to ggplot2.\n\n\n## Installation\n\nGet the development version from Github with:\n\n```R\n# install.packages(\"devtools\")\ndevtools::install_github(\"lionel-/ggstance\")\n```\n\n\n## Horizontal geoms\n\nWhile `coord_flip()` can only flip a plot as a whole, ggstance\nprovides flipped versions of Geoms, Stats and Positions. This makes it\neasier to build horizontal layer or use vertical positioning\n(e.g. vertical dodging). Also, horizontal Geoms draw horizontal\nlegend keys to keep the appearance of your plots consistent.\n\nHorizontal Geoms:\n\n- `geom_barh()`\n- `geom_colh()`\n- `geom_histogramh()`\n- `geom_linerangeh()`\n- `geom_pointrangeh()`\n- `geom_errorbarh()`\n- `geom_crossbarh()`\n- `geom_boxploth()`\n- `geom_violinh()`\n\nHorizontal Stats:\n\n- `stat_binh()`\n- `stat_boxploth()`\n- `stat_counth()`\n- `stat_xdensity()`\n- `stat_summaryh()`\n\nVertical Positions:\n\n- `position_dodgev()`\n- `position_dodge2v()`\n- `position_nudgev()`\n- `position_fillv()`\n- `position_stackv()`\n- `position_jitterdodgev()`\n\n\n## Examples\n\n### Basics ###\n\nTo create a horizontal layer in ggplot2 with `coord_flip()`, you have\nto supply aesthetics as if they were to be drawn vertically:\n\n```r\nlibrary(\"ggplot2\")\n\n# Vertical\nggplot(mpg, aes(class, hwy, fill = factor(cyl))) +\n  geom_boxplot()\n\n# Horizontal with coord_flip()\nggplot(mpg, aes(class, hwy, fill = factor(cyl))) +\n  geom_boxplot() +\n  coord_flip()\n```\n\nIn ggstance, you supply aesthetics in their natural order:\n\n```r\nlibrary(\"ggstance\")\n\n# Horizontal with ggstance\nggplot(mpg, aes(hwy, class, fill = factor(cyl))) +\n  geom_boxploth()\n```\n\n![Horizontal boxplot](https://raw.githubusercontent.com/lionel-/ggstance/readme/boxplot.png)\n\n\n### Facetting with Free Scales\n\nSome plots are hard to produce with `coord_flip()`. One case is\nfacetting with free scales. Here is an example from @smouksassi:\n\n```r\nlibrary(\"ggplot2\")\nlibrary(\"ggstance\")\n\ndf \u003c- data.frame(\n  Group = factor(rep(1:3, each = 4), labels = c(\"Drug A\", \"Drug B\", \"Control\")),\n  Subject = factor(rep(1:6, each = 2), labels = c(\"A\", \"B\", \"C\", \"D\", \"E\", \"F\")),\n  Result = rnorm(12)\n)\n\nvertical \u003c- ggplot(df, aes(Subject, Result))+\n  geom_boxplot(aes(fill = Group))+\n  facet_grid(. ~ Group, scales = \"free_x\")\nvertical\n```\n\nHow do we flip this plot? With `coord_flip()`, the free scales are not\nflipped correctly:\n\n```r\nvertical + coord_flip()\nvertical + facet_grid(Group ~ ., scales = \"free_x\") + coord_flip()\n```\n\nOn the other hand a ggstance horizontal layer will work properly:\n\n```r\nhorizontal \u003c- ggplot(df, aes(Result, Subject))+\n  geom_boxploth(aes(fill = Group))+\n  facet_grid(Group ~ ., scales = \"free_y\")\nhorizontal\n```\n\n![Horizontal free-scales facetting](https://raw.githubusercontent.com/lionel-/ggstance/readme/facet-free-scales.png)\n\n\n### Using vertical positions\n\nIn this example we use vertical dodging to align measurements\nwithin subgroups.\n\n```{r}\ndata \u003c- expand.grid(\n  Group = c(\"A\", \"B\"),\n  Subgroup = c(\"a\", \"b\", \"c\"),\n  y = 1:10\n)\ndata$y \u003c- sample(1:4, replace = TRUE, size = nrow(data))\n\nggplot(data, aes(y, Group, colour = Subgroup)) +\n  stat_sum(position = position_dodgev(height = 0.5))\n```\n\n![Vertical positions](https://raw.githubusercontent.com/lionel-/ggstance/readme/position.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flionel-%2Fggstance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flionel-%2Fggstance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flionel-%2Fggstance/lists"}