Skip to content

Commit 18e66d2

Browse files
committed
stylistic changes
1 parent 42f0d10 commit 18e66d2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

R/layers2traces.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -999,8 +999,13 @@ aes2plotly <- function(data, params, aes = "size") {
999999
defaults <- if (inherits(data, "GeomSf")) {
10001000
type <- if (any(grepl("point", class(data)))) "point" else if (any(grepl("line", class(data)))) "line" else ""
10011001
ggfun("default_aesthetics")(type)
1002-
} else if ("default_aes" %in% names(ggfun(geom))) {
1003-
ggfun(geom)$default_aes
1002+
} else {
1003+
geom_obj <- ggfun(geom)
1004+
# If the first class of `data` is a data.frame,
1005+
# ggfun() returns a function because ggplot2 now
1006+
# defines data.frame in it's namespace
1007+
# https://github.com/ropensci/plotly/pull/1481
1008+
if ("default_aes" %in% names(geom_obj)) geom_obj$default_aes else NULL
10041009
}
10051010

10061011
vals <- uniq(data[[aes]]) %||% params[[aes]] %||% defaults[[aes]] %||% NA

0 commit comments

Comments
 (0)