Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change unhighlighted colour when ink is lighter than paper #211

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

yutannihilation
Copy link
Owner

devtools::load_all("~/GitHub/gghighlight/")
#> ℹ Loading gghighlight
#> Loading required package: ggplot2

p1 <- ggplot(mtcars, aes(wt, mpg)) + 
  geom_point(size = 5) +
  theme(geom = element_geom(ink = "purple")) +
  gghighlight(mpg < 25)

do_plot <- function(ink = "black", paper = "white") {
  p <- ggplot(mtcars, aes(wt, mpg)) + 
    geom_point(size = 5) +
    theme(
      geom = element_geom(ink = ink, paper = paper),
      plot.background = element_rect(fill = paper),
      panel.background = element_rect(fill = paper)
    ) +
    gghighlight(mpg < 25)
}

p2 <- do_plot()
p3 <- do_plot("purple")
p4 <- do_plot("white", "black")
p5 <- do_plot("white", "red")
p6 <- do_plot("blue", "red")

patchwork::wrap_plots(p1, p2, p3, p4, p5, p6)

Created on 2024-09-07 with reprex v2.1.1

@yutannihilation yutannihilation merged commit 61a610b into main Sep 6, 2024
7 checks passed
@yutannihilation yutannihilation deleted the flip-color branch September 6, 2024 23:04
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.

1 participant