Closed
Description
ggplotly
fails when there is a geom_vline
-layer that does not contain any lines. For me, this happens in a setting where I have a function that computes a set of x-values at which I want to have vertical lines. Sometimes it happens that no vertical line is needed, and then ggplotly
fails with the following error message:
Fehler in fix.by(by.y, y) : 'by' must specify a uniquely valid column
Minimal example:
do_plot <- function(xintercepts) {
ggplot(mtcars, aes(mpg, carb)) + geom_point() +
geom_vline(xintercept = xintercepts)
}
plotly::ggplotly(do_plot(23)) # works fine
plotly::ggplotly(do_plot(c(15, 25))) # works fine
plotly::ggplotly(do_plot(numeric())) # produces error (but works without call to ggplotly)
Metadata
Metadata
Assignees
Labels
No labels