Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R - plotly invisible lines

Tags:

r

plotly

I have a data set df wich contains variables Name(factor), Count(integer) and Time(POSIXct).

I'm using the following code:

    df %>% plot_ly(x=~Time,y = ~Count,group = ~Name,color=~Name,type='scatter',
mode='lines+markers')

What happen is that the lines don't appear at all (the markers appear perfecly tho). Changing mode to 'lines' makes the data invisible, but the information appear whenever I hover the pointer over data locations.

Also note that running without the groups produce the excpected result (with lines visible)

        df %>% plot_ly(x=~Time,y = ~Count,type='scatter',
mode='lines+markers')

What is wrong? How to make the lines visible?

like image 788
Freguglia Avatar asked Sep 07 '17 17:09

Freguglia


1 Answers

Have you tried to ungroup the dataset? It worked for me.

df %>% 
   ungroup() %>%
   plot_ly(x=~Time,y = ~Count,type='scatter', mode='lines+markers')
like image 92
Amedeo Bellodi Avatar answered Sep 22 '22 06:09

Amedeo Bellodi