Skip to content

Commit 67dae2d

Browse files
committed
sprinkle notes
1 parent 69ae934 commit 67dae2d

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

R/aes.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ new_aesthetic <- function(x, env = globalenv()) {
131131
}
132132

133133
#' @export
134+
# TODO: should convert to proper S7 method once bug in S7 is resolved
134135
`print.ggplot2::mapping` <- function(x, ...) {
135136
cat("Aesthetic mapping: \n")
136137

@@ -146,6 +147,7 @@ new_aesthetic <- function(x, env = globalenv()) {
146147
invisible(x)
147148
}
148149

150+
# TODO: should convert to proper S7 method once bug in S7 is resolved
149151
#' @export
150152
"[.ggplot2::mapping" <- function(x, i, ...) {
151153
class_mapping(NextMethod())

R/all-classes.R

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
1+
# S3 classes --------------------------------------------------------------
12

2-
class_gg <- S7::new_class("gg", abstract = TRUE)
3-
class_S3_gg <- S7::new_S3_class("gg")
3+
# Meta classes:
4+
# TODO: These should be replaced once R 4.3.0 is the minimum version as `+`
5+
# dispatch should work as intended.
6+
class_gg <- S7::new_class("gg", abstract = TRUE)
7+
class_S3_gg <- S7::new_S3_class("gg")
8+
9+
# Proper S3 classes we need awareness for
10+
class_ggproto <- S7::new_S3_class("ggproto")
11+
class_gtable <- S7::new_S3_class("gtable")
12+
13+
# The important ggproto classes that we treat as S3 classes in S7 even though
14+
# they are their own thing.
415
class_scale <- S7::new_S3_class("Scale")
516
class_guides <- S7::new_S3_class("Guides")
617
class_coord <- S7::new_S3_class("Coord")
718
class_facet <- S7::new_S3_class("Facet")
819
class_layer <- S7::new_S3_class("Layer")
920
class_layout <- S7::new_S3_class("Layout")
1021
class_scales_list <- S7::new_S3_class("ScalesList")
11-
class_ggproto <- S7::new_S3_class("ggproto")
12-
class_gtable <- S7::new_S3_class("gtable")
22+
23+
# User facing classes -----------------------------------------------------
1324

1425
#' The theme class
1526
#'

R/plot.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ is.ggplot <- function(x) {
198198
#' print(ggplot(mpg, aes(displ, hwy, colour = .data[[colour]])) +
199199
#' geom_point())
200200
#' }
201+
# TODO: should convert to proper S7 method once bug in S7 is resolved
201202
`print.ggplot2::ggplot` <- function(x, newpage = is.null(vp), vp = NULL, ...) {
202203
set_last_plot(x)
203204
if (newpage) grid.newpage()
@@ -230,6 +231,10 @@ is.ggplot <- function(x) {
230231

231232
S7::method(plot, class_ggplot) <- `print.ggplot2::ggplot`
232233

234+
# The following extractors and subassignment operators are for a smooth
235+
# transition and should be deprecated in the release cycle after 4.0.0
236+
# TODO: should convert to proper S7 method once bug in S7 is resolved
237+
233238
#' @export
234239
`$.ggplot2::gg` <- function(x, i) {
235240
`[[`(S7::props(x), i)

0 commit comments

Comments
 (0)