View source: R/ggplot_geopos.r
ggplot_geopos | R Documentation |
In case that geolocations are provided by csv-files or data frames, line and scatter plots are implemented. If ncdf-files or kmz-files, generated by the Wildlife Computers-data portal, are selected, a SpatialPolygonsDataFrame will be created and a surface probability maps are illustrated. The netcdf transformation procedure is based on the R-code given in the location processing user guide by Wildlife Computers. The kmz-files already include the contour lines of the 50, 95 and 99% likelihood areas that are being extracted and likewise transformed to a SpatialPolygonsDataFrame. In case of kmz-files, no other areas can be selected.
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)
x |
data.frame containing horziontal position records (allowed column names are 'Most.Likely.Longitude', 'Longitude' or 'Lon' and 'Most.Likely.Latitude', 'Latitude' or 'Lat', respectively. path and file name of Please note that netcdf- and kmz-file outputs from similiar probability thresholds (e.g. 0.50) may differ due to differences in the generation algorithm. Please also note that the kmz-files from WC include only a subsample (up to 50) of the GPE3 likelihood areas. The kmz-file transformation is very fast, but due to the limitation stated above, only recommended for display purposes. Please contact WC if you need the complete GPE3 likelihood areas or use the netcdf-file transformation. |
ggobj |
ggplot object. |
xlim, ylim |
Numeric vector, defining the limts of the x and y-axes. |
zlim, Breaks, standard_year,full_year |
date range and breaks of the colorbar. If standard_year is set |
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 |
proj4string |
Coordinate reference system (CRS; projection). |
cb.title |
character string indicating the title of the colorbar (by default |
cb.date_format |
character strings indicating the date format of the color bar ticks (by default "%Y-%m-%d"). |
cbpos, cb.xlab, cb.height |
position, xlab and height of the colorbar |
prob_lim |
in case that a kmz, kml, or netcdf-file (.nc) is selected, the value defines the limit of the probability surfaces in % (By default 0.50 for 50%). Note that in case of kmz, kml-files valid values are 0.50, 0.95 or 0.99). Otherwise ignored. |
color_by |
colomn or vector by which the geolocations should be colored (by default |
pal |
color map to be plotted in case of polygon (.nc-files) or scatter plots (default is the 'jet'-colormap, and 'year.jet' in case |
cb.reverse, pal.reverse |
inverse order of ticks and colormap of colorscale. |
alpha |
transparency of polygons and dots to be plotted in percent (By default 70%). |
type |
character string giving the type of plot desired. The following values are possible, for details (By default "p" for points, but "l" for lines is also implemented). |
size, shape |
size and dot-type (by default '19' for solid dots) of the points to be plotted (requires |
lwd |
line width |
... |
additional arguments to be passed to ggplotmap. |
main |
an overall title for the plot |
verbose |
whether the file names should be printed during loading geolocation files(By default |
Robert K. Bauer
leaflet_geopos, ggplotly_geopos, ggplotmap
# ## example 1a) line plot from several csv-files:
# library(oceanmap)
# csv_file <- system.file("example_files/15P1019-104659-1-GPE3.csv",package="RchivalTag")
# pos <- get_geopos(csv_file) ## show tracks as line plot
# ggobj <- ggplot_geopos(pos)
# ggobj
# ggplotly_geopos(ggobj)
#
# ## load second file and add to plot:
# csv_file2 <- system.file("example_files/14P0911-46177-1-GPE3.csv",package="RchivalTag")
# pos2 <- get_geopos(csv_file2) ## show tracks as line plot
# ggobj2 <- ggplot_geopos(pos2)
# ggplotly_geopos(ggobj2)
#
# pos3 <- rbind(pos,pos2)
# ggobj3 <- ggplot_geopos(pos3,type = "l")
# # ggobj3 <- ggplot_geopos(pos3,type = "b")
# # ggobj3 <- ggplot_geopos(pos3,type = "p")
# ggplotly_geopos(ggobj3)
#
#
# ## example 1b) scatter plot from csv-file on existing landmask:
# ggobj <- oceanmap::ggplotmap('lion',grid.res = 5) # use keyword to derive area limits
# ggobj4 <- ggplot_geopos(csv_file,ggobj)
# ggplotly_geopos(ggobj4)
#
# ## alternatives:
# pos <- get_geopos(csv_file)
# r <- oceanmap::regions("lion")
# ggobj5 <- ggplot_geopos(pos, xlim = r$xlim, ylim = r$ylim)
# ggplotly_geopos(ggobj5)
#
#
# ## example 2) probability surfaces of horizontal tracks from nc-file:
# ## this can take some time as it inlcudes time consuming data processing
# nc_file <- system.file("example_files/15P1019-104659-1-GPE3.nc",package="RchivalTag")
# ggobj6 <- ggplot_geopos(nc_file)
# ggobj6
# ggplotly_geopos(ggobj6)
#
#
# ## alternative:
# pols_df <- get_geopos(nc_file)
# ggplot_geopos(pols_df)
#
#
# ## example 3) probability surfaces of horizontal tracks from kmz-file:
# kmz_file <- system.file("example_files/15P1019-104659-1-GPE3.kmz",package="RchivalTag")
# ggobj7 <- ggplot_geopos(kmz_file)
# ggobj7
# ggplotly_geopos(ggobj7)
#
#
# kmz_file2 <- system.file("example_files/15P0986-15P0986-2-GPE3.kmz",package="RchivalTag")
# ggobj8 <- ggplot_geopos(kmz_file2)
# ggobj8
# ggplotly_geopos(ggobj8)
#
# ## example 4) combine polygon tracks:
# k1 = get_geopos(kmz_file)
# k2 = get_geopos(kmz_file2)
#
# ggobj <- ggplotmap("mednw4")
# ## p1 <- ggplot_geopos(k1,ggobj = ggobj) ## not working, need to change date format:
# p1 <- ggplot_geopos(k1,grid.res=1)
# p1
# p2 <- ggplot_geopos(k2,p1,zlim = as.Date(range(c(k1$datetime,k2$datetime))))
# ggplotly_geopos(p2)
#
# ## change plot window:
# p1b <- ggplot_geopos(k1,ggobj = ggobj)
# p2b <- ggplot_geopos(k2,p1b,zlim = as.Date(range(c(k1$datetime,k2$datetime))))
# p2b
# ggplotly_geopos(p2b)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.