Is there a way to use the add_segments() function to create a dashed line?
I've tried using linetype, linetypes, line = list(...), dash = "dash" but nothing seems to work. Here is some sample code with a horizontal line. Right now it's just ignoring the linetype argument.
plot <- plot_ly() %>%
add_segments(x = 1, xend = 10, y = 5, yend = 5, linetype = "dashed")
plot
I have a way around this, but I like the simplicity/readability of add_segments so it would be ideal to use it as opposed to add_lines().
plotly::add_segment
does not have a linetype
argument. You can set the line type like below;
library(plotly)
plot_ly() %>%
add_segments(x = 1, xend = 10, y = 5, yend = 5, line = list(dash = "dash"))