Skip to content

Commit 4ac88f0

Browse files
committed
Draw ribbon first
1 parent 7a3430c commit 4ac88f0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

R/ggplotly.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -219,18 +219,18 @@ gg2list <- function(p){
219219
# This extracts essential info for this geom/layer.
220220
if (L$geom$objname == "smooth") {
221221
# smooth is really a line + ribbon geom
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)) {
222+
# draw ribbon (unless se = FALSE)
223+
misc$smoothRibbon <- TRUE
224+
trace1 <- if (isTRUE(L$stat_params$se == FALSE)) {
229225
NULL
230226
} else {
231-
misc$smoothRibbon <- TRUE
232227
layer2traces(L, df, misc)
233228
}
229+
misc$smoothRibbon <- FALSE
230+
# always draw the line
231+
misc$smoothLine <- TRUE
232+
trace2 <- layer2traces(L, df, misc)
233+
trace2 <- lapply(trace2, function(x) { x$showlegend <- FALSE; x })
234234
traces <- c(trace1, trace2)
235235
} else {
236236
traces <- layer2traces(L, df, misc)

0 commit comments

Comments
 (0)