ggeasy icon indicating copy to clipboard operation
ggeasy copied to clipboard

Feature request: `easy_background_fill` function

Open davidhodge931 opened this issue 2 years ago • 2 comments
trafficstars

easy_background_fill(what = c("plot", panel", "legend", "key"), to = NULL, teach = FALSE)

where to is the fill colour hex code (or colour name)

library(palmerpenguins)
library(tidyverse)
#> Warning: package 'ggplot2' was built under R version 4.3.1
#> Warning: package 'purrr' was built under R version 4.3.1
#> Warning: package 'dplyr' was built under R version 4.3.1

p <- penguins |> 
  ggplot() +
  geom_point(aes(flipper_length_mm, body_mass_g, colour = species))

p +
  theme(plot.background = element_rect(fill = "green")) +
  theme(panel.background = element_rect(fill = "red")) +
  theme(legend.background = element_rect(fill="orange")) +
  theme(legend.key = element_rect(fill = "blue"))
#> Warning: Removed 2 rows containing missing values (`geom_point()`).

Created on 2023-09-20 with reprex v2.0.2

davidhodge931 avatar Sep 19 '23 22:09 davidhodge931

That seems to fit the pattern for what ggeasy supports, so I'm on board.

I have a growing list of these to handle that I'll try to coordinate, so no guarantees on timeline, but we'll see. Thanks!

jonocarroll avatar Sep 19 '23 22:09 jonocarroll

Similar: #52

jonocarroll avatar Sep 19 '23 22:09 jonocarroll