File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,7 @@ new_aesthetic <- function(x, env = globalenv()) {
131
131
}
132
132
133
133
# ' @export
134
+ # TODO: should convert to proper S7 method once bug in S7 is resolved
134
135
`print.ggplot2::mapping` <- function (x , ... ) {
135
136
cat(" Aesthetic mapping: \n " )
136
137
@@ -146,6 +147,7 @@ new_aesthetic <- function(x, env = globalenv()) {
146
147
invisible (x )
147
148
}
148
149
150
+ # TODO: should convert to proper S7 method once bug in S7 is resolved
149
151
# ' @export
150
152
" [.ggplot2::mapping" <- function (x , i , ... ) {
151
153
class_mapping(NextMethod())
Original file line number Diff line number Diff line change
1
+ # S3 classes --------------------------------------------------------------
1
2
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.
4
15
class_scale <- S7 :: new_S3_class(" Scale" )
5
16
class_guides <- S7 :: new_S3_class(" Guides" )
6
17
class_coord <- S7 :: new_S3_class(" Coord" )
7
18
class_facet <- S7 :: new_S3_class(" Facet" )
8
19
class_layer <- S7 :: new_S3_class(" Layer" )
9
20
class_layout <- S7 :: new_S3_class(" Layout" )
10
21
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 -----------------------------------------------------
13
24
14
25
# ' The theme class
15
26
# '
Original file line number Diff line number Diff line change @@ -198,6 +198,7 @@ is.ggplot <- function(x) {
198
198
# ' print(ggplot(mpg, aes(displ, hwy, colour = .data[[colour]])) +
199
199
# ' geom_point())
200
200
# ' }
201
+ # TODO: should convert to proper S7 method once bug in S7 is resolved
201
202
`print.ggplot2::ggplot` <- function (x , newpage = is.null(vp ), vp = NULL , ... ) {
202
203
set_last_plot(x )
203
204
if (newpage ) grid.newpage()
@@ -230,6 +231,10 @@ is.ggplot <- function(x) {
230
231
231
232
S7 :: method(plot , class_ggplot ) <- `print.ggplot2::ggplot`
232
233
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
+
233
238
# ' @export
234
239
`$.ggplot2::gg` <- function (x , i ) {
235
240
`[[`(S7 :: props(x ), i )
You can’t perform that action at this time.
0 commit comments