Line sequence error
JTCDCTWB opened this issue · 2 comments
JTCDCTWB commented
In the code snippet below:
economics %>%
arrange(uempmed) %>%
plot_ly(x = ~date, y = ~uempmed, color = I("red"), type = "scatter", mode = "line+marker")The line is not drawn based on the order of dates but rather in the order the data appears. The version of plotly being used is 4.10.4.
cpsievert commented
That is by design. If you want it ordered by x, you need add_lines()
JTCDCTWB commented
Thank you very much for your answer. I have modified the code as follows:
economics %>% arrange(uempmed) %>% plot_ly(x = ~date, y = ~uempmed, name = "uempmed") %>% add_lines() %>% add_markers()
How do I combine the point and line legends into a single legend?