I want to plot two vectors on the same graph using plotly in r. the problem is that the two vectors are of different lengths, how do I graph them both even though they are of different lengths? thank you!
Your explanation of the issue is very short and not entirely clear. Is this what you mean:
library("plotly")
a = data.frame(x = 6:20, y = 6:20)
b = data.frame(x = 1:5, y = 1:5)
plot_ly(data = a, x = ~x, y = ~y) %>%
add_lines() %>%
add_lines(data = b, x = ~x, y = ~y)
If not, please provide a minimal reproducible example as outlined here: