R-绘制不可见的线条 [英] R - plotly invisible lines
本文介绍了R-绘制不可见的线条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个数据集df,其中包含变量Name(factor),Count(integer)和Time(POSIXct).
I have a data set df wich contains variables Name(factor), Count(integer) and Time(POSIXct).
我正在使用以下代码:
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?
推荐答案
您是否尝试取消数据集分组?它对我有用.
Have you tried to ungroup the dataset? It worked for me.
df %>%
ungroup() %>%
plot_ly(x=~Time,y = ~Count,type='scatter', mode='lines+markers')
这篇关于R-绘制不可见的线条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文