{"id":50344316,"url":"https://davidhodge931.github.io/ggscribe/","last_synced_at":"2026-06-15T10:00:56.873Z","repository":{"id":341692800,"uuid":"1165116221","full_name":"davidhodge931/ggscribe","owner":"davidhodge931","description":"Publication-Quality 'ggplot2' Annotation","archived":false,"fork":false,"pushed_at":"2026-05-25T01:15:20.000Z","size":6730,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-25T03:16:47.448Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://davidhodge931.github.io/ggscribe/","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-23T20:57:20.000Z","updated_at":"2026-05-25T01:13:35.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/davidhodge931/ggscribe","commit_stats":null,"previous_names":["davidhodge931/ggscribe"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/davidhodge931/ggscribe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidhodge931%2Fggscribe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidhodge931%2Fggscribe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidhodge931%2Fggscribe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidhodge931%2Fggscribe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidhodge931","download_url":"https://codeload.github.com/davidhodge931/ggscribe/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidhodge931%2Fggscribe/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34357282,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-15T02:00:07.085Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-05-29T19:00:28.471Z","updated_at":"2026-06-15T10:00:56.868Z","avatar_url":"https://github.com/davidhodge931.png","language":"R","funding_links":[],"categories":["Presentation, composition and scales"],"sub_categories":[],"readme":"---\noutput: github_document\n---\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# ggscribe \u003ca href=\"https://davidhodge931.github.io/ggscribe/\"\u003e\u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"139\" alt=\"ggscribe website\" /\u003e\u003c/a\u003e\n\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/ggscribe)](https://CRAN.R-project.org/package=ggscribe)\n\u003c!-- badges: end --\u003e\n\nThe objective of ggscribe is to provide annotation helper functions for publication-quality 'ggplot2' visualisation.\n\nNote: \n\n* Use the secondary axis, subtitle, or axis titles to adjust space. \n* `axis_*` functions placed outside the panel require `clip = \"off\"` in the coord space.\n\n## Installation\n\nInstall from CRAN, or the development version from [GitHub](https://github.com/davidhodge931/ggscribe).\n```r\ninstall.packages(\"ggscribe\")\npak::pak(\"davidhodge931/ggscribe\")\n```\n\n## Example\n\nggscribe provides various axis and panel annotation helper functions.\n\n```{r, warning=FALSE, message=FALSE}\nlibrary(ggplot2)\nlibrary(dplyr)\n\nset_theme(\n  ggrefine::theme_grey(\n    panel_heights = rep(unit(50, \"mm\"), 100),\n    panel_widths = rep(unit(75, \"mm\"), 100),\n  )\n)\n\nmtcars |\u003e\n  ggplot(aes(x = wt, y = mpg, colour = as.factor(gear), fill = as.factor(gear))) +\n  scale_colour_discrete(palette = blends::multiply(get_theme()$palette.colour.discrete)) +\n  #clip = \"off\" is required for axis_text, axis_ticks and axis_bracket\n  coord_cartesian(clip = \"off\") +\n  #reference lines and background\n  ggscribe::reference_line(xintercept = 2.4) +\n  ggscribe::reference_line(yintercept = 12)  +\n  ggscribe::panel_shade(\n    xmin = 4,\n    xmax = 5,\n  ) +\n  #top axis\n  scale_x_continuous(\n    sec.axis = ggscribe::sec_axis_text(\n      breaks = c(mean(c(4, 5))),\n      labels = c(\"Range\"),\n      guide = ggscribe::guide_sec_axis_text(\n        angle = 90,\n      )\n    )\n  ) +\n  ggscribe::axis_bracket(\n    yintercept = I(1),\n    breaks = c(4, 5),\n  ) +\n  ggscribe::axis_text(\n    yintercept = I(1),\n    breaks = c(2.4),\n    labels = c(\"Threshold\"),\n  ) +\n  #right axis\n  ggscribe::axis_text(\n    xintercept = I(1),\n    breaks = 12,\n    labels = \"Threshold\",\n  ) +\n  #bottom axis\n  ggscribe::axis_ticks(\n    yintercept = I(0),\n    breaks = 3.8,\n    length = rel(-4.5),\n  ) +\n  ggscribe::axis_text(\n    yintercept = I(0),\n    breaks = 3.8,\n    labels = \"Threshold\",\n    length = rel(-4.5),\n  ) +\n  labs(x = \"\\nWeight\") +\n  #geom\n  geom_point() +\n  #annotations fit plot\n  theme(plot.background = element_rect(colour = \"grey92\"))\n```\n\nAnd a function to ensure text is easily coloured for contrast on a fill aesthetic.\n\n```{r}\nggwidth::set_equiwidth(equiwidth = 1.75)\n\nmtcars |\u003e\n  count(cyl, am) |\u003e\n  mutate(\n    am = if_else(am == 0, \"Automatic\", \"Manual\"),\n    cyl = as.factor(cyl)\n  ) |\u003e\n  ggplot(aes(x = am, y = n, colour = cyl, fill = cyl, label = n)) +\n  geom_col(\n    position = position_dodge2(preserve = \"single\", padding = 0.05),\n    width = ggwidth::get_width(n = 2, n_dodge = 3),\n  ) +\n  scale_fill_discrete(palette = jumble::jumble) +\n  scale_colour_discrete(palette = blends::multiply(jumble::jumble)) +\n  geom_text(\n    mapping = ggscribe::aes_contrast(), # or aes(!!!ggscribe::aes_contrast()),\n    position = position_dodge2(\n      width = ggwidth::get_width(n = 2, n_dodge = 3),\n      padding = 0.05,\n      preserve = \"single\"),\n    vjust = 1.33,\n    show.legend = FALSE,\n  ) +\n  scale_y_continuous(expand = expansion(c(0, 0.05))) +\n  ggrefine::modern(x_type = \"discrete\")\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\u003ctr\u003e\n\u003ctd align=\"center\"\u003e\u003ca href=\"https://davidhodge931.github.io/ggblanket/\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/davidhodge931/ggblanket/main/man/figures/logo.svg\" width=\"120\" alt=\"ggblanket\"/\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003ca href=\"https://davidhodge931.github.io/ggrefine/\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/davidhodge931/ggrefine/main/man/figures/logo.svg\" width=\"120\" alt=\"ggrefine\"/\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003ca href=\"https://davidhodge931.github.io/ggscribe/\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/davidhodge931/ggscribe/main/man/figures/logo.svg\" width=\"120\" alt=\"ggscribe\"/\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003ca href=\"https://davidhodge931.github.io/ggwidth/\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/davidhodge931/ggwidth/main/man/figures/logo.svg\" width=\"120\" alt=\"ggwidth\"/\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003ca href=\"https://davidhodge931.github.io/blends/\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/davidhodge931/blends/main/man/figures/logo.svg\" width=\"120\" alt=\"blends\"/\u003e\u003c/a\u003e\u003c/td\u003e\n\u003ctd align=\"center\"\u003e\u003ca href=\"https://davidhodge931.github.io/jumble/\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/davidhodge931/jumble/main/man/figures/logo.svg\" width=\"120\" alt=\"jumble\"/\u003e\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\u003c/table\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/davidhodge931.github.io%2Fggscribe%2F","html_url":"https://awesome.ecosyste.ms/projects/davidhodge931.github.io%2Fggscribe%2F","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/davidhodge931.github.io%2Fggscribe%2F/lists"}