{"id":13665789,"url":"https://github.com/thomas-neitmann/ggcharts","last_synced_at":"2025-04-24T00:23:15.331Z","repository":{"id":46075567,"uuid":"231745173","full_name":"thomas-neitmann/ggcharts","owner":"thomas-neitmann","description":"Get You to Your Desired Plot Faster","archived":false,"fork":false,"pushed_at":"2021-11-16T08:27:29.000Z","size":49969,"stargazers_count":292,"open_issues_count":17,"forks_count":35,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-04-09T17:02:58.514Z","etag":null,"topics":["data-visualization","ggplot2","plots","r"],"latest_commit_sha":null,"homepage":"https://thomas-neitmann.github.io/ggcharts/index.html","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/thomas-neitmann.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}},"created_at":"2020-01-04T10:30:09.000Z","updated_at":"2025-03-11T23:10:15.000Z","dependencies_parsed_at":"2022-09-24T16:51:51.317Z","dependency_job_id":null,"html_url":"https://github.com/thomas-neitmann/ggcharts","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomas-neitmann%2Fggcharts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomas-neitmann%2Fggcharts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomas-neitmann%2Fggcharts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomas-neitmann%2Fggcharts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomas-neitmann","download_url":"https://codeload.github.com/thomas-neitmann/ggcharts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250536359,"owners_count":21446724,"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":["data-visualization","ggplot2","plots","r"],"created_at":"2024-08-02T06:00:50.697Z","updated_at":"2025-04-24T00:23:15.308Z","avatar_url":"https://github.com/thomas-neitmann.png","language":"R","funding_links":[],"categories":["R","Themes and aesthetics"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n```{r, include=FALSE}\nknitr::opts_chunk$set(\n  fig.path = \"man/figures/README-\",\n  message = FALSE,\n  warning = FALSE,\n  dev = \"svglite\",\n  fig.showtext = TRUE,\n  out.width = \"80%\"\n)\n```\n\n# ggcharts \u003cimg src=\"man/figures/ggcharts_hex.png\" align=\"right\" width=\"200\"/\u003e\n\n[![R build status](https://github.com/thomas-neitmann/ggcharts/workflows/R-CMD-check/badge.svg)](https://github.com/thomas-neitmann/ggcharts/actions)\n[![CRAN Version](https://www.r-pkg.org/badges/version/ggcharts?color=green)](https://cran.r-project.org/package=ggcharts)\n[![Total Downloads](http://cranlogs.r-pkg.org/badges/grand-total/ggcharts?color=green)](https://cran.r-project.org/package=ggcharts)\n[![Lifecycle Status](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)\n\n## Overview\n\n`{ggcharts}` provides a high-level `{ggplot2}` interface for creating common charts. Its aim is both simple and ambitious: to get you from your data visualization idea to an actual plot faster. How so? By taking care of a lot of data preprocessing, obscure `{ggplot2}` details and plot styling for you. The resulting plots are `ggplot` objects and can be further customized using any `{ggplot2}` function.\n\n\n## Installation\n\nThe package is available from CRAN.\n\n```{r install_cran, eval=FALSE}\ninstall.packages(\"ggcharts\")\n```\n\nAlternatively, you can install the latest development version from GitHub.\n\n```{r install_github, eval=FALSE}\nif (!\"remotes\" %in% installed.packages()) {\n  install.packages(\"remotes\")\n}\nremotes::install_github(\"thomas-neitmann/ggcharts\", upgrade = \"never\")\n```\n\nIf you get an error when trying to install from GitHub, run this code and then try to install once again.\n\n```{r no_errors_from_warnings, eval=FALSE}\nSys.setenv(R_REMOTES_NO_ERRORS_FROM_WARNINGS = \"true\")\n```\n\nIf the installation still fails please open an [issue](https://github.com/thomas-neitmann/ggcharts/issues).\n\n\n## Why ggcharts?\n\nThanks to `{ggplot2}` you can create beautiful plots in `R`. However, it can often take quite a bit of effort to get from a data visualization idea to an actual plot. As an example, let's say you want to create a faceted bar chart displaying the top 10 within each facet ordered from highest to lowest. What sounds simple is actually pretty hard to achieve. Have a look:\n\n```{r motivation, fig.height = 3, fig.width = 8, out.width = \"100%\"}\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(ggcharts)\ndata(\"biomedicalrevenue\")\n\nbiomedicalrevenue %\u003e%\n  filter(year %in% c(2012, 2015, 2018)) %\u003e%\n  group_by(year) %\u003e%\n  top_n(10, revenue) %\u003e%\n  ungroup() %\u003e%\n  mutate(company = tidytext::reorder_within(company, revenue, year)) %\u003e%\n  ggplot(aes(company, revenue)) +\n  geom_col() +\n  coord_flip() +\n  tidytext::scale_x_reordered() +\n  facet_wrap(vars(year), scales = \"free_y\")\n```\n\nThat's a lot of code! And you likely never heard of some of the functions involved. With `{ggcharts}` you can create the same plot (actually an even better looking one) in almost a single line of code.\n\n```{r motivation_continued, fig.height = 3, fig.width = 8, out.width = \"100%\"}\nbiomedicalrevenue %\u003e%\n  filter(year %in% c(2012, 2015, 2018)) %\u003e%\n  bar_chart(x = company, y = revenue, facet = year, top_n = 10)\n```\n\n\n## Gallery\n\n### Charts\n\n```{r ggcharts_line_chart}\ndata(\"revenue_wide\")\nline_chart(data = revenue_wide, x = year, y = Roche:Bayer) +\n  labs(x = \"Year\", y = \"Revenue (Billion USD)\")\n```\n\n\n```{r ggcharts_lollipop_chart}\nbiomedicalrevenue %\u003e%\n  filter(year == 2018) %\u003e%\n  lollipop_chart(x = company, y = revenue, threshold = 30) +\n  labs(\n    x = NULL,\n    y = \"Revenue\",\n    title = \"Biomedical Companies with Revenue \u003e $30Bn.\"\n  ) +\n  scale_y_continuous(\n    labels = function(x) paste0(\"$\", x, \"Bn.\"),\n    expand = expansion(mult = c(0, .05))\n  )\n```\n\n```{r ggcharts_dumbbell_chart}\ndata(\"popeurope\")\ndumbbell_chart(\n  data = popeurope,\n  x = country,\n  y1 = pop1952,\n  y2 = pop2007,\n  top_n = 10,\n  point_colors = c(\"lightgray\", \"#494F5C\")\n) +\n  labs(\n    x = NULL,\n    y = \"Population\",\n    title = \"Europe's Largest Countries by Population in 2007\"\n  ) +\n  scale_y_continuous(\n    limits = c(0, NA),\n    labels = function(x) paste(x, \"Mn.\")\n  )\n```\n\n```{r ggcharts_diverging_bar_chart}\ndata(mtcars)\nmtcars_z \u003c- dplyr::transmute(\n  .data = mtcars,\n  model = row.names(mtcars),\n  hpz = scale(hp)\n)\n\ndiverging_bar_chart(data = mtcars_z, x = model, y = hpz)\n```\n\n```{r ggcharts_diverging_lollipop_chart}\ndiverging_lollipop_chart(\n  data = mtcars_z,\n  x = model,\n  y = hpz,\n  lollipop_colors = c(\"#006400\", \"#b32134\"),\n  text_color = c(\"#006400\", \"#b32134\")\n)\n```\n\n```{r}\ndata(\"popch\")\npyramid_chart(data = popch, x = age, y = pop, group = sex)\n```\n\n\n### Themes\n\n```{r ggcharts_theme_hermit}\nggcharts_set_theme(\"theme_hermit\")\nbar_chart(data = diamonds, x = cut)\n```\n\n```{r ggcharts_theme_ng}\nggcharts_set_theme(\"theme_ng\")\nbar_chart(data = diamonds, x = cut)\n```\n\n```{r ggcharts_theme_nightblue}\nggcharts_set_theme(\"theme_nightblue\")\nbar_chart(data = diamonds, x = cut)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomas-neitmann%2Fggcharts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomas-neitmann%2Fggcharts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomas-neitmann%2Fggcharts/lists"}