Skip to content

Conversation

@mirober
Copy link

@mirober mirober commented Jan 28, 2020

Adds a couple of utilities for creating consistently coloured GG plot graphs, with most colours taken from here.

The main ones are scale_colour_nhsd and scale_fill_nhs, example usage:

library(gapminder)
library(tidyverse)

countries <- c("United Kingdom", "China", "Gambia")

gapminder %>%
  filter(country %in% countries) %>%
  ggplot(aes(year, lifeExp, colour=country)) +
  geom_smooth(se = FALSE) +
  labs(
    title = "Life expectancy",
    x = "Year",
    y = "Expectancy",
    caption = "Source: gapminder (2020)"
    ) +
  theme_minimal() +
  scale_colour_nhsd("blue") +
  ggsave("test.png",
         type = "cairo",
         width = 7,
         height = 4,
  )

Copy link

@murd0 murd0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for being the first contributor, Mike!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants