R - plotly invisible lines

倖福魔咒の 提交于 2019-12-23 16:10:00

问题


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?


回答1:


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

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


来源:https://stackoverflow.com/questions/46102483/r-plotly-invisible-lines

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!