{"id":13400758,"url":"https://github.com/hrbrmstr/ggeconodist","last_synced_at":"2025-03-21T12:30:58.735Z","repository":{"id":141238210,"uuid":"196842691","full_name":"hrbrmstr/ggeconodist","owner":"hrbrmstr","description":"📉 Create Diminutive Distribution Charts","archived":false,"fork":false,"pushed_at":"2019-07-23T12:51:24.000Z","size":1044,"stargazers_count":73,"open_issues_count":4,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-01T06:10:05.026Z","etag":null,"topics":["boxplots","distribution","ggplot2","r","rstats"],"latest_commit_sha":null,"homepage":"","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/hrbrmstr.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"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}},"created_at":"2019-07-14T13:55:22.000Z","updated_at":"2024-12-25T19:28:07.000Z","dependencies_parsed_at":"2024-01-17T16:56:42.147Z","dependency_job_id":"6f30dba6-5103-4447-88ce-d330e10712df","html_url":"https://github.com/hrbrmstr/ggeconodist","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/hrbrmstr%2Fggeconodist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fggeconodist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fggeconodist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fggeconodist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hrbrmstr","download_url":"https://codeload.github.com/hrbrmstr/ggeconodist/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244135909,"owners_count":20403798,"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":["boxplots","distribution","ggplot2","r","rstats"],"created_at":"2024-07-30T19:00:55.185Z","updated_at":"2025-03-21T12:30:58.351Z","avatar_url":"https://github.com/hrbrmstr.png","language":"R","funding_links":[],"categories":["Plot layers","R"],"sub_categories":[],"readme":"---\noutput: rmarkdown::github_document\neditor_options: \n  chunk_output_type: console\n---\n```{r pkg-knitr-opts, include=FALSE}\nhrbrpkghelpr::global_opts()\n```\n\n```{r badges, results='asis', echo=FALSE, cache=FALSE}\nhrbrpkghelpr::stinking_badges()\n```\n\n# ggeconodist\n\nCreate Diminutive Distribution Charts\n\n## Description\n\n'The Economist' has a unique boxplot aesthetic f or\ncommunicating distrribution characteristics. Tools are provided\nto create similar charts in 'ggplot2'.\n\nInspired by: \u003chttps://www.economist.com/united-states/2019/06/29/will-transparent-pricing-make-americas-health-care-cheaper\u003e\n\n## What's Inside The Tin\n\n```{r ingredients, results='asis', echo=FALSE, cache=FALSE}\nhrbrpkghelpr::describe_ingredients()\n```\n\nThe following functions are implemented:\n\n## Installation\n\n```{r install-ex, results='asis', echo=FALSE, cache=FALSE}\nhrbrpkghelpr::install_block()\n```\n\n## Usage\n\n```{r lib-ex}\nlibrary(ggeconodist)\n\n# current version\npackageVersion(\"ggeconodist\")\n\n```\n\n### The whole shebang\n\n**YOU WILL NEED** to install [these fonts](https://github.com/economist-components/component-typography) to use the built-in theme. More on how to do that at some point.\n\n```{r mam}\nggplot(mammogram_costs, aes(x = city)) +\n  geom_econodist(\n    aes(ymin = tenth, median = median, ymax = ninetieth),\n    stat = \"identity\", show.legend = TRUE\n  ) +\n  scale_y_continuous(expand = c(0,0), position = \"right\", limits = range(0, 800)) +\n  coord_flip() +\n  labs(\n    x = NULL, y = NULL,\n    title = \"Mammoscams\",\n    subtitle = \"United States, prices for a mammogram*\\nBy metro area, 2016, $\",\n    caption = \"*For three large insurance companies\\nSource: Health Care Cost Institute\"\n  ) +\n  theme_econodist() -\u003e gg\n\ngrid.newpage()\nleft_align(gg, c(\"subtitle\", \"title\", \"caption\")) %\u003e% \n  add_econodist_legend(econodist_legend_grob(), below = \"subtitle\") %\u003e% \n  grid.draw()\n```\n\n```{r mpg}\nlibrary(dplyr)\nlibrary(patchwork)\nlibrary(hrbrthemes)\nlibrary(gapminder)\n\np \u003c- ggplot(mpg, aes(class, hwy)) + theme_ipsum_rc()\n\n(p + geom_boxplot()) +\n(p + geom_econodist(width = 0.25)) +\n  plot_layout(ncol = 1)\n\n(p + geom_boxplot() + coord_flip()) +\n(p + geom_econodist(tenth_col = ft_cols$blue, ninetieth_col = ft_cols$red) +\n   coord_flip()) +\n  plot_layout(ncol = 1)\n\n(p + geom_boxplot(aes(fill = factor(drv)))) +\n  (p + geom_econodist(aes(fill = factor(drv)))) +\n  plot_layout(ncol = 1)\n```\n\n```{r gm, fig.width=600/72, fig.height=700/72}\ngapminder %\u003e%\n  filter(year %in% c(1952, 1962, 1972, 1982, 1992, 2002)) %\u003e%\n  filter(continent != \"Oceania\") %\u003e%\n  ggplot(aes(x = factor(year), y = lifeExp, fill = continent)) +\n  geom_econodist(\n    median_point_size = 1.2,\n    tenth_col = \"#b07aa1\",\n    ninetieth_col = \"#591a4f\",\n    show.legend = FALSE\n  ) +\n  ggthemes::scale_fill_tableau(name = NULL) +\n  coord_flip() +\n  labs(\n    x = \"Year\", title = \"Life Expectancy\", y = NULL,\n    caption = \"Example borrowed from @cmdline_tips\"\n  ) +\n  facet_wrap(~continent, nrow = 4) +\n  theme_ipsum_rc() -\u003e gmgg\n\ngrid.newpage()\ngmgg %\u003e% \n  add_econodist_legend(\n    econodist_legend_grob(\n      tenth_col = \"#b07aa1\",\n      ninetieth_col = \"#591a4f\",\n    ), \n    below = \"axis-b-1-4\", \n    just = \"right\"\n  ) %\u003e% \n  grid.draw()\n```\n\n## ggeconodist Metrics\n\n```{r cloc, echo = FALSE}\ncloc::cloc_pkg_md()\n```\n\n## Code of Conduct\n\nPlease note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrbrmstr%2Fggeconodist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhrbrmstr%2Fggeconodist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrbrmstr%2Fggeconodist/lists"}