Skip to content

Adjust for S7 in ggplot2 #429

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Adjust for S7 in ggplot2 #429

wants to merge 9 commits into from

Conversation

teunbrand
Copy link
Contributor

Hi Thomas,

This PR accompanies tidyverse/ggplot2#6364. It should be compatible with 3.5.2 as well as the linked PR. Briefly, it does two things:

  1. It registers S7 methods with the new ggplot2 and S3 methods with the old ggplot2
  2. The patches field is implemented as attribute rather than a list-item, to not mess with S7 object properties and such.

Comment on lines 118 to 133
`$.patchwork` <- function(x, i) {
if (i == "patches") {
attr(x, "patches")
} else {
NextMethod()
}
}
#' @export
`$<-.patchwork` <- function(x, i, value) {
if (i == "patches") {
attr(x, "patches") <- value
x
} else {
NextMethod()
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is absolutely lazyness on my part, because I wasn't keen on finding every instance of where the patches object is accessed.

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