Skip to content

Adjust for S7 in ggplot2#429

Closed
teunbrand wants to merge 9 commits intothomasp85:mainfrom
teunbrand:S7
Closed

Adjust for S7 in ggplot2#429
teunbrand wants to merge 9 commits intothomasp85:mainfrom
teunbrand:S7

Conversation

@teunbrand
Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Collaborator 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.

@teunbrand
Copy link
Copy Markdown
Collaborator Author

closing in favour of #430

@teunbrand teunbrand closed this May 26, 2025
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