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

use_defaults() method passes extra arguments #241

Merged
merged 1 commit into from
Jul 20, 2024

Conversation

teunbrand
Copy link
Contributor

@teunbrand teunbrand commented Jul 19, 2024

Hi Matthew,

Pardon for the cold PR!
We discovered through reverse dependency checks that the way {ggdist}'s use_defaults() method is implemented is incompatible with a new feature we're planning for {ggplot2}.
The new feature is described in tidyverse/ggplot2#5833, but the TL;DR is that we want to allow geoms to derive their default aesthetics from a theme element.

This PR aims to make {ggdist} compatible that feature in {ggplot2}.
We aim to include that feature in the next version of ggplot2, which isn't scheduled to come out until next year.
I'd be happy to provide more context if needed!

Here is an example of {ggdist} + the new feature in action.

devtools::load_all("~/packages/test/ggdist/") # this PR
#> ℹ Loading ggdist
library(ggplot2)
packageVersion("ggplot2") # from the linked PR
#> [1] '3.5.1.9000'

df <- data.frame(x = rnorm(1000))

# Set default fill to be derived from theme
update_geom_defaults("slabinterval", aes(fill = from_theme(accent)))

# Using theme to set the default accent colour for geoms
ggplot(df, aes(x)) +
  stat_halfeye() +
  theme(geom = element_geom(accent = "dodgerblue"))

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

@mjskay
Copy link
Owner

mjskay commented Jul 20, 2024

Ah cool, looks like a nice new feature!

No apologies for cold PR necessary :)

Thanks!

@mjskay mjskay merged commit 2c1de53 into mjskay:master Jul 20, 2024
1 of 8 checks passed
@teunbrand teunbrand deleted the compatibility_ggplot_3_6_0 branch July 22, 2024 09:03
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