Skip to content

Commit 9e716df

Browse files
committed
fix a couple strange bugs
1 parent 55b47f5 commit 9e716df

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

R/plotly_build.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ plotly_build.plotly <- function(p) {
6161
rapply(x, eval_attr, data = dat, how = "list"),
6262
class = oldClass(x)
6363
)
64+
6465
# determine trace type (if not specified, can depend on the # of data points)
6566
# note that this should also determine a sensible mode, if appropriate
6667
trace <- verify_type(trace)
@@ -97,7 +98,9 @@ plotly_build.plotly <- function(p) {
9798
tryCatch(identical(x[["valType"]], "data_array"), error = function(e) FALSE)
9899
})
99100
dataArrayAttrs <- names(Attrs)[as.logical(isArray)]
100-
tr <- trace[names(trace) %in% c(npscales(), special_attrs(trace), dataArrayAttrs)]
101+
# for some reason, text isn't listed as a data array attributein some traces
102+
# I'm looking at you scattergeo...
103+
tr <- trace[names(trace) %in% c(npscales(), special_attrs(trace), dataArrayAttrs, "text")]
101104
# TODO: does it make sense to "train" matrices/2D-tables (e.g. z)?
102105
tr <- tr[vapply(tr, function(x) is.null(dim(x)), logical(1))]
103106
builtData <- tibble::as_tibble(tr)
@@ -323,8 +326,6 @@ map_size <- function(traces) {
323326
scales::rescale(s, from = sizeRange, to = traces[[1]]$sizes)
324327
}
325328
if (hasMarker[[i]]) {
326-
# plotly.js
327-
sizeI <- rep(sizeI, length.out = max(lengths(traces[[i]])))
328329
traces[[i]]$marker <- modify_list(
329330
list(size = sizeI, sizemode = "area"),
330331
traces[[i]]$marker

0 commit comments

Comments
 (0)