Learn R Programming

RchivalTag (version 0.2.2)

ggplot_geopos: Reads and plots geolocation estimates derived from archival tagging data

Description

Geolocations provided via CSV or data frames are plotted as line or scatter plots. If netCDF (.nc) or KMZ files from the Wildlife Computers portal are selected, a SpatialPolygonsDataFrame is created and surface probability maps are illustrated. The netCDF transformation follows the R-code in the Location Processing User Guide. KMZ files already include contour lines of the 50, 95, and 99% likelihood areas, which are extracted and transformed to a SpatialPolygonsDataFrame.

Usage

ggplot_geopos(x, ggobj, xlim, ylim, zlim, standard_year=FALSE, 
              full_year=standard_year, date_format, lang_format="en", tz="UTC", 
              Breaks, cb.title, cb.date_format, cbpos, cb.height = 10, cb.xlab = "",
              cb.reverse=FALSE, pal.reverse=cb.reverse, prob_lim=.75, color_by="date", 
              pal, alpha=70, type="p",
              main ,lwd=1, size=2, shape=19, verbose= FALSE, ...)

get_geopos(x, xlim, ylim, date_format, lang_format="en", tz="UTC", proj4string, prob_lim=.5, verbose=TRUE)

Arguments

x

data.frame containing horizontal position records, or a path/filename of .csv, .kmz, .kml, or .nc-files.

ggobj

A ggplot object (optional base plot).

xlim, ylim

Numeric vectors defining the limits of the x- and y-axes.

zlim, Breaks, standard_year, full_year

Date range and breaks of the colorbar. If standard_year = TRUE, positions are standardized yearly and tick breaks are ignored. If full_year = TRUE, the color scale covers all months from January to December.

date_format, lang_format, tz

character strings indicating the date format, language format and the corresponding time zone, defined by the vectors Date and Time (by default: date_format="%d-%b-%Y %H:%M:%S", lang_format="en", tz='UTC') If formatting fails, please check as well the input language format, defined by lang_format (and use abbrviations such as "en" for English,"es" for Spanish, "fr" for French, etc.) as well.

proj4string

Coordinate reference system (CRS; projection).

cb.title

Title of the colorbar (default "Date").

cb.date_format

Date format of the colorbar ticks (default "%Y-%m-%d").

cbpos, cb.xlab, cb.height

Position, x-axis label, and height of the colorbar.

prob_lim

For kmz, kml, or netCDF (.nc) files, defines the probability surface limit in %. Default 50%. Valid KMZ/KML values: 50, 95, 99.

color_by

Column or vector used for coloring geolocations (default "date").

pal

Color map used for polygon (.nc) or scatter plots. See cmap for pre-installed color maps.

cb.reverse, pal.reverse

Inverse order of ticks and colormap of colorscale.

alpha

Transparency of polygons or dots in percent (default 70).

type

Plot type: "p" for points (default), "l" for lines, "b" for both.

size, shape

Point size and type (default 2 and 19 for solid dots).

lwd

Line width.

...

Additional arguments passed to ggplotmap.

main

Overall plot title.

verbose

Whether file names should be printed when loading geolocation files (default TRUE for get_geopos(), FALSE for ggplot_geopos()).

Author

Robert K. Bauer

See Also

leaflet_geopos, ggplotly_geopos, ggplotmap, SpatialPolygonsDataFrame

Examples

Run this code
# Example 1a: Line plot from CSV
# library(oceanmap)
# csv_file <- system.file("example_files/15P1019-104659-1-GPE3.csv", package="RchivalTag")
# pos <- get_geopos(csv_file)
# ggobj <- ggplot_geopos(pos)
# ggobj
# ggplotly_geopos(ggobj)

# Example 1b: Scatter plot on existing landmask
# ggobj <- oceanmap::ggplotmap("lion", grid.res=5)
# ggobj4 <- ggplot_geopos(csv_file, ggobj)
# ggplotly_geopos(ggobj4)

# Example 2: Probability surfaces from netCDF
# nc_file <- system.file("example_files/15P1019-104659-1-GPE3.nc", package="RchivalTag")
# ggobj6 <- ggplot_geopos(nc_file)
# ggplotly_geopos(ggobj6)

# Example 3: Probability surfaces from KMZ
# kmz_file <- system.file("example_files/15P1019-104659-1-GPE3.kmz", package="RchivalTag")
# ggobj7 <- ggplot_geopos(kmz_file)
# ggplotly_geopos(ggobj7)

Run the code above in your browser using DataLab