We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4aa3ff6 commit 679f990Copy full SHA for 679f990
R/plotly.R
@@ -387,6 +387,12 @@ plotly_build <- function(l = last_plot()) {
387
x <- c(x, kwargs)
388
# traces shouldn't have any names
389
x$data <- setNames(x$data, NULL)
390
+ # if this is a non-line scatter trace and no hovermode exists,
391
+ # set hovermode to closest
392
+ if (is.null(x$data[[1]]$type) || isTRUE(x$data[[1]]$type == "scatter")) {
393
+ if (!grepl("lines", x$data[[1]]$mode %||% "lines"))
394
+ x$layout$hovermode <- x$layout$hovermode %||% "closest"
395
+ }
396
# add plotly class mainly for printing method
397
structure(x, class = unique("plotly", class(x)))
398
}
0 commit comments