Latitude monthly variation
Updated on 2024-05-07 22:40:57
Using the ecotopia_data_devices_gps function in the EcotopiaR package, you can get GPS data of animals to generate scatter plots and line plots with ggplot2 to analyze the latitude changes during the animals' migration.
In the example below, EcotopiaR gets GPS data from one device over 495 days and generates scatter plots and line plots of latitude against year and month. It can be observed that this bird migrates to higher latitudes during the months of March to May each year, and migrates back to lower latitudes during the months of September to October.
Example
# Draw GPS data on the map # Import EcotopiaR library(EcotopiaR) library(ggplot2) now <- Sys.time() attr(now, "tzone") <- "UTC" start_time <- now - as.difftime(495, unit = "days") gps_list <- ecotopia_data_devices_gps( device_uuids = c("5d2fe382879cb586138e356d"), show_progress = "FULL", start_time = start_time ) # Draw Map world <- ne_countries(scale = "medium", returnclass = "sf") gps <- gps_list[["5d2fe382879cb586138e356d"]] gps <- gps[gps$used_star > 3, ] gps$latitude <- as.numeric(gps$latitude) gps$timestamp <- as.Date(paste0(substr(gps$timestamp, 1, 7), "-01")) plot <- ggplot(gps, aes(x = timestamp, y = latitude)) + geom_point(color = "blue") + labs(title = "Latitude And Month", x = "Month", y = "Latitude") ggsave("examples/gps_map_single_latitude.png", plot)
Copied!