# NOT RUN {
#Load move and moveVis packages
library(move)
library(moveVis)
#Get the sample data from the moveVis package
data("move_data")
move_data$dt <- as.POSIXct(strptime(move_data$dt, "%Y-%m-%d %H:%M:%S", tz = "UTC"))
#Create moveStack object including multiple individuals
data_ani <- move(move_data$lon, move_data$lat, proj=CRS("+proj=longlat +ellps=WGS84"),
time = move_data$dt, animal=move_data$individual, data=move_data)
#Load basemap MODIS NDVI data
data("basemap_data")
layer = basemap_data[[1]]
layer_dt = basemap_data[[2]]
#Find command or directory to convert tool of ImageMagick
conv_dir <- get_libraries()
#Specify the output directory, e.g.
out_dir <- "/out/test"
#or to a temporary directory:
out_dir <- paste0(tempdir(),"/test")
dir.create(out_dir)
#Call animate_stats()
animate_stats(data_ani, out_dir, conv_dir = conv_dir,
layer=layer, layer_dt = layer_dt, layer_type = "gradient",
stats_digits = 1, stats_type = "bar", out_name = "moveVis_ani",
log_level = 1,frames_nmax = 60)
stats_gg <- 'ggplot(data = stats_obj[[k]][[b]][[x]],
aes_(x = ~val, y = ~value, colour = ~variable)) +
geom_line() + geom_point() + theme_bw() + theme(aspect.ratio=1) +
scale_y_continuous(expand = c(0,0),limits = c(0,stats_max[k])) +
scale_x_continuous(expand = c(0,0)) +
scale_color_manual(name= "",values = cols) +
labs(x = "Basemap Value", y="Frequency",
title=stats_title[[b]][[k]], label=c("123","456"))+
theme(plot.title = element_text(hjust = 0.5),
plot.subtitle = element_text(hjust = 0.5))'
#Call animate_stats() with stats_gg
animate_stats(data_ani, out_dir, conv_dir = conv_dir,
layer=layer, layer_dt = layer_dt, layer_type = "gradient",
stats_digits = 1, stats_gg = stats_gg, out_name = "moveVis_ani",
log_level = 1,frames_nmax = 60)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab