plotly.R
plotly.R copied to clipboard
plotly cannot handle Inf or -Inf when plotting
plotly does not seem to know what to do with values that are Inf or -Inf. The expected behavior (as done by ggplot2) is to map those values to the maximum and minimum values representable in the type when plotting but to not include them in calculations related to ranges, zooming, axis labels, grid lines, etc.
library(dplyr)
library(ggplot2)
# as expected, this extends the line up to limits of the plot
p <- data.frame(x=c(1,1,Inf), y = c(Inf, 1, 1)) %>% ggplot(aes(x=x,y=y)) + geom_line()
p
library(plotly)
# This doesn't plot anything
ggplotly(p)