@@ -77,23 +77,12 @@ ggplot <- function(data = NULL, mapping = aes(), ...,
77
77
# ' @export
78
78
ggplot.default <- function (data = NULL , mapping = aes(), ... ,
79
79
environment = parent.frame()) {
80
- ggplot.data.frame(fortify(data , ... ), mapping , environment = environment )
81
- }
82
-
83
- # ' @export
84
- ggplot.function <- function (data = NULL , mapping = aes(), ... ,
85
- environment = parent.frame()) {
86
- # Added to avoid functions end in ggplot.default
87
- stop(" You're passing a function as global data.\n Have you misspelled the `data` argument in `ggplot()`" , call. = FALSE )
88
- }
89
-
90
- # ' @export
91
- ggplot.data.frame <- function (data , mapping = aes(), ... ,
92
- environment = parent.frame()) {
93
80
if (! missing(mapping ) && ! inherits(mapping , " uneval" )) {
94
81
stop(" Mapping should be created with `aes() or `aes_()`." , call. = FALSE )
95
82
}
96
83
84
+ data <- fortify(data , ... )
85
+
97
86
p <- structure(list (
98
87
data = data ,
99
88
layers = list (),
@@ -112,11 +101,10 @@ ggplot.data.frame <- function(data, mapping = aes(), ...,
112
101
}
113
102
114
103
# ' @export
115
- ggplot.grouped_df <- function (data , mapping = aes(), ... ,
116
- environment = parent.frame()) {
117
-
118
- data $ .group <- dplyr :: group_indices(data )
119
- ggplot.data.frame(data , mapping = mapping , ... , environment = environment )
104
+ ggplot.function <- function (data = NULL , mapping = aes(), ... ,
105
+ environment = parent.frame()) {
106
+ # Added to avoid functions end in ggplot.default
107
+ stop(" You're passing a function as global data.\n Have you misspelled the `data` argument in `ggplot()`" , call. = FALSE )
120
108
}
121
109
122
110
plot_clone <- function (plot ) {
0 commit comments