r - 具有多个分类值的 ggplot 时间序列的最佳方法
问题描述
我正在使用以下数据集:
team, time, rank1, rank2, rank3, rank4, rank5
bull, 20180102,0,0,0,0,1
corn, 20180102,0,29,0,0,1
fivfo, 20180102,23,4,0,0,1
lazy, 20180102,0,0,0,0,1
tt, 20180102,0,4,222,0,1
cheer, 20180102,23,0,34,0,1
manup, 20180102,0,13,0,0,1
bull, 20180103,0,10,0,10,1
corn, 20180103,0,59,0,0,1
fivfo, 20180103,43,4,0,0,1
lazy, 20180103,0,0,0,0,1
tt, 20180103,0,4,122,0,1
cheer, 20180103,23,0,34,0,11
manup, 20180103,0,13,10,0,11
目标是在反映日期时间的同时绘制每个团队的排名。我试图使用熔化,但无法真正确定要熔化哪个轴。
我尝试按如下方式使用熔体:
melt.s <- melt(s, id=c("team","time"))
ggplot(melt.s,aes(x=time,y=value,colour=variable,group=variable)) + geom_line()
上面的问题是team
名称并没有真正出现关键带走我想展示的情节是团队以及他们达到排名的时间。
试图找出最好的绘图方式,但到目前为止考虑如下
rank5 |
rank4 |
rank3 | legend (team)
rank2 |
rank1 |___________________
time
解决方案
推荐阅读
- c++ - 这个失败的 C++ 字符串比较我错过了什么?
- intake - 数据持久化到原始数据源
- python - 如何在 sympy 的情节中使轴成为正确的长度
- c# - 如何从 Microsoft Store 获得应用许可证?
- ios - 执行获取时未调用 FetchedResultController 中的方法
- tensorflow - 我得到了 1.86 的验证损失,我应该如何减少它?
- reactjs - 不要在 react 中重新渲染 HOC 组件
- javascript - 选择网格中的多个复选框
- javascript - 如何在功能性反应组件中洗牌一次数组?
- angular - 在服务器上预渲染有角度的通用应用程序时检测设备类型