File tree Expand file tree Collapse file tree 1 file changed +18
-46
lines changed Expand file tree Collapse file tree 1 file changed +18
-46
lines changed Original file line number Diff line number Diff line change
1
+ # ' @rdname ggplot2-ggproto
2
+ # ' @format NULL
3
+ # ' @usage NULL
4
+ # ' @export
5
+ StatManual <- ggproto(
6
+ " StatManual" , Stat ,
7
+
8
+ setup_params = function (data , params ) {
9
+ params $ fun <- allow_lambda(params $ fun )
10
+ check_function(params $ fun , arg = " fun" )
11
+ params
12
+ },
13
+
14
+ compute_group = function (data , scales , fun = identity , args = list ()) {
15
+ as_gg_data_frame(inject(fun(data , !!! args )))
16
+ }
17
+ )
1
18
2
19
# ' Manually compute transformations
3
20
# '
83
100
# ' args = vars(hull = chull(x, y), x = x[hull], y = y[hull])
84
101
# ' )
85
102
# ' }
86
- stat_manual <- function (
87
- mapping = NULL ,
88
- data = NULL ,
89
- geom = " point" ,
90
- position = " identity" ,
91
- ... ,
92
- fun = identity ,
93
- args = list (),
94
- na.rm = FALSE ,
95
- show.legend = NA ,
96
- inherit.aes = TRUE ) {
97
-
98
- layer(
99
- data = data ,
100
- mapping = mapping ,
101
- stat = StatManual ,
102
- geom = geom ,
103
- position = position ,
104
- show.legend = show.legend ,
105
- inherit.aes = inherit.aes ,
106
- params = list2(
107
- na.rm = na.rm ,
108
- fun = fun ,
109
- args = args ,
110
- ...
111
- )
112
- )
113
- }
114
-
115
- # ' @rdname ggplot2-ggproto
116
- # ' @format NULL
117
- # ' @usage NULL
118
- # ' @export
119
- StatManual <- ggproto(
120
- " StatManual" , Stat ,
121
-
122
- setup_params = function (data , params ) {
123
- params $ fun <- allow_lambda(params $ fun )
124
- check_function(params $ fun , arg = " fun" )
125
- params
126
- },
127
-
128
- compute_group = function (data , scales , fun = identity , args = list ()) {
129
- as_gg_data_frame(inject(fun(data , !!! args )))
130
- }
131
- )
103
+ stat_manual <- make_constructor(StatManual , geom = " point" )
You can’t perform that action at this time.
0 commit comments