plot_util_distr: plots resulting track over map with uncertainty shown by...

Description Usage Arguments Value Author(s) Examples

View source: R/new_plotting_functions.R

Description

May be use not only for the whole track but for a set of specific dates, e.g. to show spatial uncertainty during migration. Note that you can use it only after obtaining and registering in you current session Google Api Key. For details on the API key check [here](http://ornithologyexchange.org/forums/topic/38315-mapflightrggmap-error).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
plot_util_distr(
  Result,
  dates = NULL,
  map.options = NULL,
  percentiles = c(0.4, 0.6, 0.8),
  zoom = "auto",
  geom_polygon.options = NULL,
  save.options = NULL,
  color.palette = NULL,
  use.palette = TRUE,
  background = NULL,
  plot = TRUE,
  save = TRUE,
  add.scale.bar = FALSE,
  scalebar.options = NULL
)

Arguments

Result

FLightR result object obtained from run.particle.filter

dates

Use NULL if all twilights will be used for plotting, one integer if specific twilight should be plotted (line number in Result$Results$Quantiles). Use data.frame with first column - start of the period and second - end of the period and each line represents a new period to plot specific periods, e.g. wintering or migration.

map.options

options passed to get_map, note that zoom option is defined separately

percentiles

Probability breaks for utilisation distribution

zoom

Zoom for map. If 'auto' FLightR will try to find optimal zoom level by downloading different size maps and checking whether all the points fit the map.

geom_polygon.options

options passed to geom_polygon

save.options

options passed to ggsave. Filename should be defined here.

color.palette

colors for probability contours. Either NULL or colorRampPalette object

use.palette

should the same colors be used for polygon boundaries as for polygon filling?

background

if provided will be used as a background. Must be created by link[ggmap]{get_map}

plot

should function produce a plot?

save

should function save results with ggsave?

add.scale.bar

will add scalebar with the scalebar

scalebar.options

options passed to scalebar

Value

list with two parts

res_buffers

spatial buffers for defined probability values

p

ggplot object

Author(s)

Eldar Rakhimberdiev

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
File<-system.file("extdata", "Godwit_TAGS_format.csv", package = "FLightR")
# to run example fast we will cut the real data file by 2013 Aug 20
Proc.data<-get.tags.data(File, end.date=as.POSIXct('2013-06-25', tz='GMT'))
Calibration.periods<-data.frame(
       calibration.start=as.POSIXct(c(NA, "2014-05-05"), tz='GMT'),
       calibration.stop=as.POSIXct(c("2013-08-20", NA), tz='GMT'),
       lon=5.43, lat=52.93) 
       #use c() also for the geographic coordinates, if you have more than one calibration location
       # (e. g.,  lon=c(5.43, 6.00), lat=c(52.93,52.94))

# NB Below likelihood.correction is set to FALSE for fast run! 
# Leave it as default TRUE for real examples
Calibration<-make.calibration(Proc.data, Calibration.periods, likelihood.correction=FALSE)

Grid<-make.grid(left=0, bottom=50, right=10, top=56,
  distance.from.land.allowed.to.use=c(-Inf, Inf),
  distance.from.land.allowed.to.stay=c(-Inf, Inf))

all.in<-make.prerun.object(Proc.data, Grid, start=c(5.43, 52.93),
                             Calibration=Calibration, threads=1)
# here we will run only 1e4 partilces for a very short track.
# One should use 1e6 particles for the full run
Result<-run.particle.filter(all.in, threads=1,
           nParticles=1e3, known.last=TRUE,
           precision.sd=25, check.outliers=FALSE)

## Not run: 
plot_util_distr(Result, zoom=6, save=FALSE)

## End(Not run)

FLightR documentation built on July 6, 2021, 5:08 p.m.