@@ -219,19 +219,22 @@ gg2list <- function(p){
219
219
# This extracts essential info for this geom/layer.
220
220
if (L $ geom $ objname == " smooth" ) {
221
221
# smooth is really a line + ribbon geom
222
- misc $ smoothRibbon <- TRUE
223
- trace1 <- if (isTRUE(L $ stat_params $ se == FALSE )) {
222
+ # always draw the line
223
+ misc $ smoothLine <- TRUE
224
+ trace1 <- layer2traces(L , df , misc )
225
+ trace1 <- lapply(trace1 , function (x ) { x $ showlegend <- FALSE ; x })
226
+ misc $ smoothLine <- FALSE
227
+ # draw ribbon unless se = FALSE
228
+ trace2 <- if (isTRUE(L $ stat_params $ se == FALSE )) {
224
229
NULL
225
230
} else {
231
+ misc $ smoothRibbon <- TRUE
226
232
layer2traces(L , df , misc )
227
233
}
228
- misc $ smoothRibbon <- FALSE
229
- misc $ smoothLine <- TRUE
230
- traces <- c(trace1 , layer2traces(L , df , misc ))
234
+ traces <- c(trace1 , trace2 )
231
235
} else {
232
236
traces <- layer2traces(L , df , misc )
233
237
}
234
-
235
238
possible.legends <- markLegends [[L $ geom $ objname ]]
236
239
actual.legends <- possible.legends [possible.legends %in% names(L $ mapping )]
237
240
layer.legends [[paste(i )]] <- actual.legends
0 commit comments