{"id":47170313,"url":"https://davidhodge931.github.io/ggwidth/","last_synced_at":"2026-03-27T09:00:43.919Z","repository":{"id":339237935,"uuid":"1160472436","full_name":"davidhodge931/ggwidth","owner":"davidhodge931","description":"Standardise 'ggplot2' Width","archived":false,"fork":false,"pushed_at":"2026-03-17T03:34:13.000Z","size":2045,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-17T16:59:10.060Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://davidhodge931.github.io/ggwidth/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidhodge931.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-18T01:23:15.000Z","updated_at":"2026-03-17T03:32:39.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/davidhodge931/ggwidth","commit_stats":null,"previous_names":["davidhodge931/ggwidth"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/davidhodge931/ggwidth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidhodge931%2Fggwidth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidhodge931%2Fggwidth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidhodge931%2Fggwidth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidhodge931%2Fggwidth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidhodge931","download_url":"https://codeload.github.com/davidhodge931/ggwidth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidhodge931%2Fggwidth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31040829,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-27T08:32:29.083Z","status":"ssl_error","status_checked_at":"2026-03-27T08:32:27.811Z","response_time":164,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2026-03-13T05:00:31.254Z","updated_at":"2026-03-27T09:00:43.911Z","avatar_url":"https://github.com/davidhodge931.png","language":"R","funding_links":[],"categories":["Presentation, composition and scales"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\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# ggwidth \u003ca href=\"https://davidhodge931.github.io/ggwidth/\"\u003e\u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"139\" alt=\"ggwidth website\" /\u003e\u003c/a\u003e\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/ggwidth)](https://CRAN.R-project.org/package=ggwidth)\n\u003c!-- badges: end --\u003e\n\nThe objective of ggwidth is to standardise 'ggplot2' geom width.\n\nIt provides methods to ensure the width in ggplot2 geoms are visually consistent across plots with different numbers of categories, panel dimensions, and orientations.\n\nIt works with geoms such as `geom_bar`/`geom_col`, `geom_boxplot` and `geom_errorbar`.\n\nNote this function requires:\n\n* a set theme with panel widths and heights specified\n* `\"x\"` orientation plots to have a x discrete scale with default expand\n* `\"y\"` orientation plots to have a y discrete scale with default expand.\n\n## Installation\n\nInstall from CRAN, or development version from [GitHub](https://github.com/).\n```r\ninstall.packages(\"ggwidth\") \npak::pak(\"davidhodge931/ggwidth\")\n```\n\n## Example\n\n```{r setup, message=FALSE}\nlibrary(ggplot2)\nlibrary(dplyr)\nlibrary(ggwidth)\nlibrary(patchwork)\n\nset_theme(\n  theme_grey() +\n    theme(panel.widths  = rep(unit(75, \"mm\"), 2)) +\n    theme(panel.heights = rep(unit(50, \"mm\"), 2))\n)\n\nset_equiwidth(1)\n```\n```{r example-1}\np1 \u003c- mpg |\u003e\n  ggplot(aes(x = drv)) +\n  geom_bar(\n    width = get_width(n = 3),\n    colour = \"black\",\n    fill = \"grey\",\n  )\n\np2 \u003c- diamonds |\u003e\n  ggplot(aes(x = color)) +\n  geom_bar(\n    width = get_width(n = 7),\n    colour = \"black\",\n    fill = \"grey\",\n  )\n\np3 \u003c- diamonds |\u003e\n  ggplot(aes(y = color)) +\n  geom_bar(\n    width = get_width(n = 7, orientation = \"y\"),\n    colour = \"black\",\n    fill = \"grey\",\n  )\n\np4 \u003c- mpg |\u003e\n  ggplot(aes(x = drv, group = factor(cyl))) +\n  geom_bar(\n    position = position_dodge(preserve = \"single\"),\n    width = get_width(n = 3, n_dodge = 4),\n    colour = \"black\",\n    fill = \"grey\",\n  ) \n\np1 + p2 + p3 + p4\n```\n```{r example-2}\nd \u003c- tibble::tibble(\n  continent = c(\"Europe\", \"Europe\", \"Europe\", \"Europe\", \"Europe\",\n                \"South America\", \"South America\"),\n  country   = c(\"AT\", \"DE\", \"DK\", \"ES\", \"PK\", \"TW\", \"BR\"),\n  value     = c(10L, 15L, 20L, 25L, 17L, 13L, 5L)\n)\n\nmax_n \u003c- d |\u003e\n  count(continent) |\u003e\n  pull(n) |\u003e\n  max()\n\nd |\u003e\n  mutate(country = forcats::fct_rev(country)) |\u003e\n  ggplot(aes(y = country, x = value)) +\n  geom_col(\n    width = get_width(n = max_n, orientation = \"y\"),\n    colour = \"black\",\n    fill = \"grey\",\n  ) +\n  facet_wrap(~continent, scales = \"free_y\") +\n  scale_y_discrete(continuous.limits = c(1, max_n)) +\n  coord_cartesian(reverse = \"y\", clip = \"off\")\n```\n```{r example-3}\nmpg |\u003e\n  ggplot(aes(x = drv)) +\n  geom_bar(\n    width = get_width(n = 3, panel_widths = unit(160, \"mm\")),\n    colour = \"black\",\n    fill = \"grey\",\n  ) +\n  theme(panel.widths = unit(160, \"mm\"))\n```\n\n## Other packages\n\nThis package is part of a group of related packages built to extend [ggplot2](https://ggplot2.tidyverse.org).\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\" valign=\"top\"\u003e\n      \u003ca href=\"https://davidhodge931.github.io/ggblanket\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/davidhodge931/ggblanket/main/man/figures/logo.svg\" width=\"120\" alt=\"ggblanket\"/\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\" valign=\"top\"\u003e\n      \u003ca href=\"https://davidhodge931.github.io/ggrefine\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/davidhodge931/ggrefine/main/man/figures/logo.svg\" width=\"120\" alt=\"ggrefine\"/\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\" valign=\"top\"\u003e\n      \u003ca href=\"https://davidhodge931.github.io/ggscribe\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/davidhodge931/ggscribe/main/man/figures/logo.svg\" width=\"120\" alt=\"ggscribe\"/\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\" valign=\"top\"\u003e\n      \u003ca href=\"https://davidhodge931.github.io/ggwidth\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/davidhodge931/ggwidth/main/man/figures/logo.svg\" width=\"120\" alt=\"ggwidth\"/\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\" valign=\"top\"\u003e\n      \u003ca href=\"https://davidhodge931.github.io/blends\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/davidhodge931/blends/main/man/figures/logo.svg\" width=\"120\" alt=\"blends\"/\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd align=\"center\" valign=\"top\"\u003e\n      \u003ca href=\"https://davidhodge931.github.io/jumble\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/davidhodge931/jumble/main/man/figures/logo.svg\" width=\"120\" alt=\"jumble\"/\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/davidhodge931.github.io%2Fggwidth%2F","html_url":"https://awesome.ecosyste.ms/projects/davidhodge931.github.io%2Fggwidth%2F","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/davidhodge931.github.io%2Fggwidth%2F/lists"}