{"id":13401000,"url":"https://github.com/eliocamp/ggnewscale","last_synced_at":"2025-05-14T20:04:24.246Z","repository":{"id":60917775,"uuid":"161934647","full_name":"eliocamp/ggnewscale","owner":"eliocamp","description":"Multiple Fill, Color and Other Scales in `ggplot2`","archived":false,"fork":false,"pushed_at":"2025-02-24T09:23:23.000Z","size":10419,"stargazers_count":414,"open_issues_count":4,"forks_count":18,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-01T10:06:21.128Z","etag":null,"topics":["ggplot2","r","r-package","rstats"],"latest_commit_sha":null,"homepage":"https://eliocamp.github.io/ggnewscale/","language":"TeX","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eliocamp.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2018-12-15T18:50:10.000Z","updated_at":"2025-03-22T11:01:19.000Z","dependencies_parsed_at":"2024-04-17T01:29:21.149Z","dependency_job_id":"22ac342c-1375-4026-94de-4448198bce6e","html_url":"https://github.com/eliocamp/ggnewscale","commit_stats":{"total_commits":163,"total_committers":3,"mean_commits":"54.333333333333336","dds":"0.018404907975460127","last_synced_commit":"08b83e9db443b0f055e72af2fcaf47128e5bc7a5"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eliocamp%2Fggnewscale","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eliocamp%2Fggnewscale/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eliocamp%2Fggnewscale/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eliocamp%2Fggnewscale/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eliocamp","download_url":"https://codeload.github.com/eliocamp/ggnewscale/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247829490,"owners_count":21002995,"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":["ggplot2","r","r-package","rstats"],"created_at":"2024-07-30T19:00:57.765Z","updated_at":"2025-04-08T11:06:53.978Z","avatar_url":"https://github.com/eliocamp.png","language":"TeX","funding_links":[],"categories":["Themes and aesthetics","TeX","R"],"sub_categories":[],"readme":"---\noutput: github_document\nknit: (function(input, ...) devtools::build_readme())\n---\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r setup, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\"\n)\n```\n# ggnewscale \u003cimg src='man/figures/logo.png' align=\"right\" height=\"138.5\" /\u003e\n \n\u003c!-- badges: start --\u003e\n\n[![R build\nstatus](https://github.com/eliocamp/ggnewscale/workflows/R-CMD-check/badge.svg)](https://github.com/eliocamp/ggnewscale/actions)\n[![Codecov test\ncoverage](https://codecov.io/gh/eliocamp/ggnewscale/branch/master/graph/badge.svg)](https://app.codecov.io/gh/eliocamp/ggnewscale?branch=master)\n[![DOI](https://zenodo.org/badge/161934647.svg)](https://zenodo.org/badge/latestdoi/161934647)\n[![CRAN\nstatus](http://www.r-pkg.org/badges/version/ggnewscale)](https://cran.r-project.org/package=ggnewscale)\n\u003c!-- badges: end --\u003e\n\n`ggnewscale` tries to make it painless to use multiple scales in `ggplot2`. Although originally intended to use with colour and fill, it should work with any `aes`, such as `shape`, `linetype` and the rest.\n\n[ggnewscale: spend 400% more time tweaking your ggplot!](https://web.archive.org/web/20220511154749/https://twitter.com/mattansb/status/1524415881920528385)\n\nFor another way of defining multiple scales, you can also try [relayer](https://github.com/clauswilke/relayer).\n\n## How to install\n\nYou can install ggnewscale from CRAN with:\n\n```{r CRAN-installation, eval = FALSE}\ninstall.packages(\"ggnewscale\")\n```\n\nOr the development version with:\n\n```r\n# install.packages(\"devtools\")\ndevtools::install_github(\"eliocamp/ggnewscale\")\n```\n\n## How to cite\n\nIf you use ggnewscale in a publication, I'll be grateful if you cited it. To get the suggested citation for this (and any other R package) you can use:\n\n```{r}\ncitation(\"ggnewscale\")\n```\n\nIf you use knitr, [you can automate this](https://bookdown.org/yihui/rmarkdown-cookbook/write-bib.html) with\n\n```r\nknitr::write_bib(c(\"ggnewscale\"), \"packages.bib\")\n```\n\nAnd then add citations with `@R-ggnewscale`.\n\n\n\u003cdetails\u003e\n \u003csummary\u003eClick to see a list of some publications that have cited ggnewscale. Thanks!\u003c/summary\u003e\n\n```{r echo=FALSE, message=FALSE, warning=FALSE, results='asis'}\nbib \u003c- \"ggnewscale-cited.bib\"\n\nRefManageR::ReadBib(bib)\n```\n\u003c/details\u003e\n\n## Usage\n\nThe main function is `new_scale()` and its aliases `new_scale_color()` and `new_scale_fill()`. When added to a plot, every geom added after them will use a different scale.\n\nAs an example, let's overlay some measurements over a contour map of topography using the beloved `volcano`. \n\n```{r}\nlibrary(ggplot2)\nlibrary(ggnewscale)\n# Equivalent to melt(volcano)\ntopography \u003c- expand.grid(x = 1:nrow(volcano),\n                          y = 1:ncol(volcano))\ntopography$z \u003c- c(volcano)\n\n# point measurements of something at a few locations\nset.seed(42)\nmeasurements \u003c- data.frame(x = runif(30, 1, 80),\n                           y = runif(30, 1, 60),\n                           thing = rnorm(30))\n\nggplot(mapping = aes(x, y)) +\n  geom_contour(data = topography, aes(z = z, color = stat(level))) +\n  # Color scale for topography\n  scale_color_viridis_c(option = \"D\") +\n  # geoms below will use another color scale\n  new_scale_color() +\n  geom_point(data = measurements, size = 3, aes(color = thing)) +\n  # Color scale applied to geoms added after new_scale_color()\n  scale_color_viridis_c(option = \"A\")\n```\n\n\nIf you want to create new scales for other `aes`, you can call `new_scale` with the name of the `aes`. For example, use \n\n```{r, eval = FALSE}\nnew_scale(\"linetype\")\n```\n\nto add multiple linetype scales. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feliocamp%2Fggnewscale","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feliocamp%2Fggnewscale","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feliocamp%2Fggnewscale/lists"}