Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions R/plotly_build.R
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,12 @@ plotly_build.plotly <- function(p, registerFrames = TRUE) {
)
for (i in x$.plotlyVariableMapping) {
# try to reduce the amount of data we have to send for non-positional scales
x[[i]] <- structure(
if (i %in% npscales()) uniq(d[[i]]) else d[[i]],
class = oldClass(x[[i]])
)
entry <- if (i %in% npscales()) uniq(d[[i]]) else d[[i]]
if (is.null(entry)) {
x[[i]] <- NULL
} else {
x[[i]] <- structure(entry, class = oldClass(x[[i]]))
}
}
x
})
Expand Down
7 changes: 7 additions & 0 deletions tests/testthat/test-ggplot-lines.R
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,10 @@ test_that("geom_linerange() without a y aesthetic translates to a path", {
)

})

test_that("NA values do not cause a lot of warnings when ploting (#1299)", {
df <- data.frame(x=1:2, y=NA)
p <- plot_ly(df, x=~x, y=~y)
expect_warning(plotly_build(p), "Ignoring")
expect_failure(expect_warning(plotly_build(p), "structure"))
})