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!

# Graphing vectors of different lengths in plotly

Hi,

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:

Grtz,

PJ

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.