Is There A Package To Visualize How Animals See In R
moveVis
Introduction
moveVis
provides tools to visualize movement data (e.g. from GPS tracking) and temporal changes of environmental data (e.g. from remote sensing) by creating video animations. Information technology works with move
and raster
class inputs and turns them into ggplot2
frames that can be farther customized. moveVis
uses gifski
(wrapping the gifski cargo crate) and av
(bounden to FFmpeg) to render frames into animated GIF or video files.
A peer-reviewed open-access paper accompanying moveVis
has been published in Methods in Ecology and Evolution.
Figure 1: Example movement tracks nearby Lake of Constance on top of a OSM watercolor and a mapbox satellite base of operations map
Figure 2: Example motility tracks nearby Lake of Constance and a gradient base layer faded over time
Installation
With version 0.10.0, the package has been rewritten from the ground upwardly with the goal to brand information technology easier to customize the advent of movement animations. Thus, the logic of the package, its functions and their syntax have changed.
The latest stable version of moveVis
can exist installed from CRAN:
install.packages( "moveVis" )
The evolution version can be installed from GitHub:
devtools ::install_github( "16EAGLE/moveVis" )
Code written for moveVis
version <=0.9.9 will not piece of work with newer versions, simply information technology is quite simple and thus highly recommended to switch to the new syntax due to a variety of advantages. moveVis
version <=0.ix.9 tin notwithstanding be downloaded here and installed manually:
setwd( "your/download/directory" ) install.packages( "moveVis-0.nine.9.tar.gz" , repos = Nada)
Function overview
moveVis
includes the following functions, sorted by the lodge they would exist practical to create an animation from movement and ecology data:
Preparing movement tracks
-
df2move()
converts adata.frame
into amove
ormoveStack
object. This is useful if y'all do not usually work with themove
classes and your tracks are present asdata.frames
. -
align_move()
aligns single and multi-individual movement data to a uniform time scale with a uniform temporal resolution needed for creating an blitheness from it. Employ this part to prepare your movement data for animation depending on the temporal resolution that suits your information. -
subset_move()
subsets amove
ormoveStack
by a given time span. This is useful if you lot want to create a movement animation of only a temporal subset of your data, e.chiliad. a particular 24-hour interval.
Creating frames
-
get_maptypes()
returns a grapheme vector of bachelor map types that can be used withframes_spatial()
.moveVis
supports OpenStreetMap and Mapbox basemap imagery. Alternatively, you tin can provide custom imagery toframes_spatial()
. -
frames_spatial()
creates a list ofggplot2
maps displaying movement. Each object represents a single frame. Each frame tin be viewed or modified individually. The returned list of frames tin can be animated usinganimate_frames()
. -
frames_graph()
creates a list ofggplot2
graphs displaying movement-environment interaction. Each object represents a single frame. Each frame can be viewed or modified individually. The returned list of frames can be animated usinganimate_frames()
.
Adapting frames
-
add_gg()
addsggplot2
functions (east.g. to add layers such as points, polygons, lines, or to change scales etc.) to the blitheness frames created withframes_spatial()
orframes_graph()
. Instead of creating your ownggplot2
functions, you lot can use i of the othermoveVis
`add_``functions: -
add_labels()
adds graphic symbol labels such as title or centrality labels to animation frames created withframes_spatial()
orframes_graph()
. -
add_scalebar()
adds a scalebar to the blitheness frames created withframes_spatial()
orframes_graph()
. -
add_northarrow()
adds a north arrow to the animation frames created withframes_spatial()
orframes_graph()
. -
add_progress()
adds a progress bar to animation frames created withframes_spatial()
orframes_graph()
. -
add_timestamps()
adds timestamps to animation frames created withframes_spatial()
orframes_graph()
. -
add_text()
adds static or dynamically changing text to the animation frames created withframes_spatial()
orframes_graph()
. -
add_colourscale()
adjusts the colour scales of the blitheness frames created withframes_spatial()
and custom map imagery using ther_list
statement. -
join_frames()
side-by-side joins theggplot2
objects of 2 or more than frames lists of equal lengths into a unmarried list ofggplot2
objects per frame usingcowplot::plot_grid
. This is useful if you lot want to side-by-side combine spatial frames returned byframes_spatial()
with graph frames returned byframes_graph()
. -
get_frametimes()
extracts the timestamps associated with each frame of a list of frames created usingframes_spatial()
orframes_graph()
and returns them every bit a vector.
Animating frames (equally GIF or video)
-
suggest_formats()
returns a selection of suggested file formats that can exist used without_file
ofanimate_frames()
on your organization. -
animate_frames()
creates an animation from a list of frames computed withframes_spatial()
,frames_graph()
orjoin_frames()
.
Viewing motility tracks
-
view_spatial()
displays motion tracks on an interactivemapview
orleaflet
map.
Processing settings
-
use_multicore()
enables multi-core usage for computational expensive processing steps. -
use_disk()
enables the usage of deejay space for creating frames, which can forbid memory overload when creating frames for very large animations.
Go started
The following example shows how to make a uncomplicated blitheness using a default base map by start adjustment your movement data to a uniform time scale, creating a list of ggplot2
frames and turning these frames into an animated GIF
:
library(moveVis) library(motility) information( "move_data" , parcel = "moveVis" ) # move form object # if your tracks are present equally data.frames, encounter df2move() for conversion # align move_data to a uniform time scale m <- align_move(move_data, res = four, unit = "mins" ) # create spatial frames with a OpenStreetMap watercolour map frames <- frames_spatial(grand, path_colours = c( "red" , "green" , "blue" ), map_service = "osm" , map_type = "watercolor" , alpha = 0.v) %>% add_labels(x = "Longitude" , y = "Latitude" ) %>% # add some customizations, such as axis labels add_northarrow() %>% add_scalebar() %>% add_timestamps(thou, type = "characterization" ) %>% add_progress() frames[[100]] # preview 1 of the frames, e.g. the 100th frame # animate frames animate_frames(frames, out_file = "moveVis.gif" )
Examples
You lot can find code examples on how to use moveVis
here:
Example ane: Creating a simple movement animation
Case 2: Customizing frames
Instance 3: Using a mapbox satellite base map
Instance iv: View motion tracks
Real-data example using White Storks (Ciconia ciconia) migration movement data [.docx]
Code snippets
These commented moveVis
code snippets, addressing specific issues or questions, could likewise be helpful to you lot:
How to hold the last frame of an animation for a divers fourth dimension and brand it expect good by using path_fade
How to display the full traces of each path using trace_show and trace_colour with frames_spatial()
How to colour paths based on a continuous variable
How to assign multiple path colours per individual, east.k. to indicate behavioral segments
How to conform the path legend of frames created with frames_spatial()
How to create a information.frame containing each track coordinate per frame
How to overlay frames with additional transparent rasters changing over time (hacky, not a very optimal solution)
Farther resource
Detailed lawmaking examples explaining how to employ specific functions are provided at the part help pages. User contributions such as code examples or tutorials are very welcome and are linked beneath as before long as they have been spotted somewhere on the web:
Animating animal tracks from multiple years over a mutual twelvemonth with moveVis: An example with Blue Whale Argos tracks on Movebank by Daniel M. Palacios, Marine Mammal Institute, Oregon Land University
Reproducible case of how to combine animate being tracking data, tidal water top data and a heightmap to visualize animal motion with moveVis by Henk-Jan van der Kolk, Holland Constitute of Environmental (NIOO-KNAW)
How to build animated tracking maps using tracking data in Movebank and ecology covariates in track and raster annotations from EnvDATA with moveVis by Sarah C. Davidson, Data Curator at Movebank
Mentions
Blog post: Featured article in Event 11.5: Our May issue is now online! by Methods in Ecology and Development
Features to exist added
Things and features that should be added in future versions of moveVis
(experience free to contribute to this list using a pull request):
Near future:
- follow population way
- follow individual mode
Some day:
- 3D animations, e.g. for including altitude data
Related packages
The Department of Remote Sensing of the University of Würzburg has developed other R packages that might involvement you:
- getSpatialData, a package to query, preview and download satellite data,
- RStoolbox, a package providing a wide range of tools for every-mean solar day remote sensing processing needs,
- rsMove, a package providing tools to query and analyze movement data using remote sensing.
For other news on the work at at the Department of Remote Sensing of the University of Würzburg, click here.
Acknowledgements
This initiative is part of the Opt4Environment project and was funded by the German Aerospace Center (DLR) on behalf of the Federal Ministry for Economic Affairs and Energy (BMWi) with the research grant 50 EE 1403.
Citation
An open-access newspaper accompanying the moveVis
R packet has been peer-reviewed by and published in 'Methods in Ecology and Evolution' (see https://doi.org/ten.1111/2041-210X.13374). Please cite moveVis, due east.k. when you lot use it in publications or presentations, using the output of citation("moveVis")
or equally follows:
Schwalb-Willmann, J.; Remelgado, R.; Safi, Chiliad.; Wegmann, M. (2020). moveVis: Animating movement trajectories in synchronicity with static or temporally dynamic environmental data in R. Methods Ecol Evol. 2020; 11: 664–669. https://doi.org/10.1111/2041-210X.13374
Source: https://github.com/16EAGLE/moveVis
Posted by: franklinhoge1949.blogspot.com
0 Response to "Is There A Package To Visualize How Animals See In R"
Post a Comment