简体   繁体   中英

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

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.

I tried to visualize the data using gganimate package.

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. I hope you find this helpful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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