{"id":14066124,"url":"https://github.com/unhcr-dataviz/unhcrthemes","last_synced_at":"2025-10-22T04:53:04.200Z","repository":{"id":45298033,"uuid":"333769982","full_name":"unhcr-dataviz/unhcrthemes","owner":"unhcr-dataviz","description":"UNHCR branded theme for ggplot2 and data visualization colour palettes","archived":false,"fork":false,"pushed_at":"2025-09-04T12:18:25.000Z","size":51765,"stargazers_count":32,"open_issues_count":1,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-22T04:52:47.412Z","etag":null,"topics":["ggplot2","ggplot2-scales","ggplot2-themes"],"latest_commit_sha":null,"homepage":"https://unhcr-dataviz.github.io/unhcrthemes/","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/unhcr-dataviz.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2021-01-28T13:38:55.000Z","updated_at":"2025-10-10T08:15:23.000Z","dependencies_parsed_at":"2023-08-21T12:45:50.582Z","dependency_job_id":"cb9e61fa-376a-42b7-a64b-79117027aae3","html_url":"https://github.com/unhcr-dataviz/unhcrthemes","commit_stats":null,"previous_names":["unhcr-dataviz/unhcrthemes","vidonne/unhcrthemes"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/unhcr-dataviz/unhcrthemes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unhcr-dataviz%2Funhcrthemes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unhcr-dataviz%2Funhcrthemes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unhcr-dataviz%2Funhcrthemes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unhcr-dataviz%2Funhcrthemes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unhcr-dataviz","download_url":"https://codeload.github.com/unhcr-dataviz/unhcrthemes/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unhcr-dataviz%2Funhcrthemes/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280382997,"owners_count":26321423,"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","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","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":["ggplot2","ggplot2-scales","ggplot2-themes"],"created_at":"2024-08-13T07:04:57.001Z","updated_at":"2025-10-22T04:53:04.185Z","avatar_url":"https://github.com/unhcr-dataviz.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\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  fig.retina = 2,\n  dpi = 300,\n  dev = \"ragg_png\"\n)\n```\n\n# unhcrthemes \u003cimg src='man/figures/logo.svg' align=\"right\" alt=\"unhcrthemes package hex sticker\" width=\"140\" alt=\"unhcrthemes package hex sticker\" /\u003e\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)\n[![R-CMD-check](https://github.com/unhcr-dataviz/unhcrthemes/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/unhcr-dataviz/unhcrthemes/actions/workflows/R-CMD-check.yaml)\n[![CRAN status](https://www.r-pkg.org/badges/version/unhcrthemes)](https://CRAN.R-project.org/package=unhcrthemes)\n\u003c!-- badges: end --\u003e\n\nSimplify the creation of your data visualizations with the `{unhcrthemes}` R package. It is designed to align your plots with [UNHCR's data visualization](https://dataviz.unhcr.org/guidance/) recommendations. This package offers a comprehensive `{ggplot2}` theme, including built-in customizations and thoughtfully crafted color palettes.\n\n## Features\n\n- A consistent and appealing `{ggplot2}` theme that matches [UNHCR Data Visualization Guidelines](https://dataviz.unhcr.org/guidance/).\n- A collection of color palettes ensuring your plots are consistent with [UNHCR's color scheme](https://dataviz.unhcr.org/guidance/).\n- Easy-to-use functions to apply the theme and color palettes to your `{ggplot2}` plots.\n\n## Installation\n\nGet started by installing the `{unhcrthemes}` package from CRAN with:\n\n```{r install, eval=FALSE}\ninstall.packages(\"unhcrthemes\")\n```\n\nOr retrieve the development version from Github using the `{pak}` package:\n\n```{r pak, eval=FALSE}\n# If pak is not yet installed, uncomment the following line:\n# install.packages(\"pak\")\n\npak::pkg_install(\"unhcr-dataviz/unhcrthemes\")\n```\n\n## Usage\n\n```{r load, message = FALSE, warning = FALSE}\n# Load required packages\nlibrary(ggplot2)\nlibrary(unhcrthemes)\n```\n\n### Base `{ggplot2}` theme\n\n```{r base-plot, message = FALSE, warning = FALSE, out.width=\"90%\", fig.align=\"center\"}\n# Apply the theme_unhcr() to your plot\nggplot(\n  mtcars,\n  aes(x = hp, y = mpg)\n) +\n  geom_point() +\n  labs(\n    title = \"Simple scatterplot with ggplot\",\n    subtitle = \"This plot shows the default style of theme_unhcr()\",\n    x = \"Horsepower (hp)\",\n    y = \"Fuel efficiency (mpg)\",\n    caption = \"Source: mtcars\"\n  ) +\n  theme_unhcr()\n```\n\n### Fonts\n\nOne of the two officially recommended fonts outlined in the [UNHCR Data Visualization Guidelines](https://dataviz.unhcr.org/guidance/) is [`Lato`](https://fonts.google.com/specimen/Lato). To ensure optimal functionality of the `{unhcrthemes}` package, please make sure that the `Lato` font is installed on your device prior to usage.\n \nFor `R` PDF (`pdf`) and PostScript (`postcript`) devices, there is a function `import_lato` that can be used to import the `Lato` font into these two devices. We recommend the use of `cairo_pdf` or `cairo_ps` devices, which work when you have `Lato` installed. They are available on all platforms and have better support custom fonts.\n\n### Color palettes\n\nChoose from a variety of carefully curated color palettes that harmonize with UNHCR's visual identity.\n\n```{r palette-all, message = FALSE, warning = FALSE, out.width=\"90%\", fig.align=\"center\", fig.height=6}\n# Display all unhcr color palette\ndisplay_unhcr_all()\n```\n\n```{r palette-blue, message = FALSE, warning = FALSE, out.width=\"90%\", fig.align=\"center\", fig.height=2}\n# Or select a specific one and limit the number of colors\ndisplay_unhcr_pal(n = 3, \"pal_blue\")\n```\n\n### Scales (color/fill)\n\n```{r scale-plot, message = FALSE, warning = FALSE, out.width=\"90%\", fig.align=\"center\"}\n# Add color scale to your plot\nggplot(\n  mtcars,\n  aes(x = hp, y = mpg, color = as.factor(cyl))\n) +\n  geom_point(alpha = .8) +\n  labs(\n    title = \"Simple scatterplot with ggplot\",\n    subtitle = \"This plot shows the default style of theme_unhcr()\",\n    x = \"Horsepower (hp)\",\n    y = \"Fuel efficiency (mpg)\",\n    color = \"Number of cylinder\",\n    caption = \"Source: mtcars\"\n  ) +\n  scale_color_unhcr_d() +\n  theme_unhcr(legend_title = TRUE)\n```\n\n### Geoms (text/label)\n\n```{r geom-plot, message = FALSE, warning = FALSE, out.width=\"90%\", fig.align=\"center\", fig.height=4}\n# Default Lato font also apply for geom_text and label\ndplyr::count(mpg, class) |\u003e\n  dplyr::arrange(n) |\u003e\n  dplyr::mutate(class = factor(class, levels = class)) |\u003e\n  ggplot(aes(n, class)) +\n  geom_col(fill = unhcr_pal(n = 1, \"pal_blue\")) +\n  geom_text(aes(label = n), hjust = 0, nudge_x = 1) +\n  labs(\n    title = \"Simple bar chart with labels using ggplot\",\n    subtitle = \"This plot shows the default style of theme_unhcr()\",\n    caption = \"Source: mtcars\"\n  ) +\n  scale_x_continuous(expand = expansion(c(0, 0.1))) +\n  theme_unhcr(grid = FALSE, axis = \"y\", axis_title = FALSE, axis_text = \"y\")\n```\n\nExplore more examples of `{unhcrthemes}` in action on the [package vignette](https://unhcr-dataviz.github.io/unhcrthemes/articles/unhcrthemes.html) or [UNHCR Data Visualization Platform](https://dataviz.unhcr.org/tutorials/r/).\n\n```{r child=\"man/rmdfragments/unhcr_tools.Rmd\"}\n```\n\n## Acknowledgements\n\nWe extend our gratitude to the creators of the [`{hrbrthemes}`](https://github.com/hrbrmstr/hrbrthemes), [`{rcartocolor}`](https://github.com/Nowosad/rcartocolor) and [`{cowplot}`](https://github.com/wilkelab/cowplot/) packages that influenced the development of `{unhcrthemes}`.\n\n## Contribution and Code of Conduct\n\nContributions to `{unhcrthemes}` are highly valued. To ensure a welcoming and inclusive community, we follow our [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). If you have suggestions, uncover bugs, or envision new features, kindly submit an [issue on GitHub](https://github.com/unhcr-dataviz/unhcrthemes/issues). To contribute code, don't hesitate to fork the repository and create a pull request.\n\n## License\n\nThis package is distributed under the [MIT License](https://github.com/unhcr-dataviz/unhcrthemes/blob/master/LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funhcr-dataviz%2Funhcrthemes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funhcr-dataviz%2Funhcrthemes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funhcr-dataviz%2Funhcrthemes/lists"}