Skip to content

docs(update_plot): Remove @keywords internal #6516

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

Closed
wants to merge 1 commit into from

Conversation

schloerke
Copy link
Contributor

If this method is to be leveraged, it should be public.

{GGally} is looking forward to this method

@schloerke
Copy link
Contributor Author

/document

@teunbrand
Copy link
Collaborator

teunbrand commented Jun 18, 2025

The update_plot() generic is a workaround for an S7 issue (RConsortium/S7#543).
I'm not sure we'd want to advertise its usage if S7 allows S3 methods for S7 generics as mentioned in the issue.
If S7 solves the issue, we can all stick to ggplot_add() and no migration is necessary.

@schloerke
Copy link
Contributor Author

schloerke commented Jun 18, 2025

Ah! I had missed that we can no override the + with S7 double dispatch. 🎉🎉

S7::method(`+`, list(class_ggplot, S7::class_any)) <- function(e1, e2) {
e2name <- deparse(substitute(e2, env = caller_env(2)))
add_ggplot(e1, e2, e2name)
}
S7::method(`+`, list(class_theme, S7::class_any)) <- function(e1, e2) {
e2name <- deparse(substitute(e2, env = caller_env(2)))
add_theme(e1, e2, e2name)
}

Related: Double dispatch with an S3 object in the first slot isn't dispatching properly: #6504


Slightly related:
GGally would no longer need +.gg method now that ggplot2 v4 leverages S7. However, GGally only needs ggplot2 >= v3.5.

To get around this, GGally can conditionally export it's +.gg method depending on the ggplot2 version. Similar to https://github.com/RConsortium/S7/blob/db5964265a88d114fb6de97361060979ad63b3d6/vignettes/packages.Rmd#L62-L66 , but with #' @rawNamespace if (packageVersion("ggplot2") < "3.5.2.9001") S3method("+",gg)

@schloerke
Copy link
Contributor Author

Closing as PR isn't needed

@schloerke schloerke closed this Jun 18, 2025
@schloerke schloerke deleted the patch-2 branch June 18, 2025 17:52
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.

None yet

2 participants