简体   繁体   English

如何用坐标可视化时间序列?

[英]How can I visualise time series with coordinates?

I am trying to get this data plotted. 我试图绘制这些数据。 I am not sure which package to use. 我不确定要使用哪个包。

Data looks like this in excel excel中的数据看起来像这样

Time    [4710.19    4710.21 4710.23 4710.24 4710.26 4710.28 4710.29]
X   [176.5  176.5   176.5   177 179 180.5   182.5   185.5]
Y   [222    227.5   237 247.5   263 278 296 314]

I would like to get animation of the X and Y plot along the time stamps. 我想沿着时间戳获得X和Y图的动画。

I tried to visualize the data using gganimate package. 我尝试使用gganimate包可视化数据。

library(gganimate)
library(ggplot2)
Time = c(4710.19, 4710.21, 4710.23, 4710.24,  4710.26,  4710.28,  4710.29, 4710.30)
X = c(176.5, 176.5, 176.5, 177,  179,  180.5, 182.5, 185.5)
Y = c(222, 227.5, 237, 247.5, 263, 278, 296, 314)
dat = data.frame(Time, X, Y)

ggplot(dat, aes(X, Y)) +
  geom_point()+
  theme_minimal() +
  transition_states(Time) + 
  ease_aes('cubic-in-out')

This worked for me. 这对我有用。 Please try. 请试试。 You need ggplot2 and gganimate packages installed to generate this visualization. 您需要安装ggplot2gganimate包才能生成此可视化。 I hope you find this helpful. 我希望你觉得这有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM