Description Usage Arguments Examples
View source: R/plotLocations.R
A general plotting function
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
sldf |
Shapefile or SpatialLinesDataFrame representation of the river network. |
detects |
Output of |
extent |
A vector of length four specifying the plotting extent c(x_min, x_max, y_min, y_max) |
open_maps |
If open_maps=T, a background will be plotted using ( |
type |
The background to use (see |
darken |
Increase to darken the background when open_maps=T. Defaults to 1. |
col_by_fish |
col_by_fish=T assigns each fish a unique color. This color will be preserved between mappings (i.e. between different flight periods). |
flight_num |
Numerical argument specifying the flight period to plot. Defaults to all. |
channel |
Vector with the channel numbers to plot. If channel=NA, all channels will be used. |
tag_id |
Vector with the tag ids to plot. If tag_id=NA, all tag ids will be used. |
viterbi |
Use viterbi=T to color by survival state using the viterbi path (detects needs to be the viterbi output from |
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 31 32 33 34 35 36 | # plotting all detections
par(mfrow=c(1,1))
make_plot(sldf, all_data)
# real detections only
make_plot(sldf, best_detects)
# darken background
make_plot(sldf, best_detects, darken=2.5)
# change style of background
make_plot(sldf, best_detects, type="esri-topo")
# remove background -- can be useful if OpenStreetMap is unavailable on your machine
make_plot(sldf, best_detects, open_maps=F)
# give each fish a unique color preserved through flights -- unfortunately there are only so many colors
par(mfrow=c(3,1))
make_plot(sldf, best_detects, col_by_fish=T, flight=1, darken=2.5)
make_plot(sldf, best_detects, col_by_fish=T, flight=2, darken=2.5)
make_plot(sldf, best_detects, col_by_fish=T, flight=3, darken=2.5)
# to plot the locations for a single fish
par(mfrow=c(1,1))
make_plot(sldf, best_detects, channel=10, tag_id=11, darken=2.5)
# to zoom in to a specified extent
extent <- c(x_min=466060, x_max=1174579, y_min=6835662, y_max=7499016)
temp<-make_plot(sldf, best_detects, extent, darken=2.5)
# plotting live and dead fish by flight period -- green fish have expired
par(mfrow=c(3,1))
viterbi <- hmm_survival(best_detects)$viterbi
make_plot(sldf, viterbi, type="bing", darken=2.5, viterbi=T, flight=1)
make_plot(sldf, viterbi, type="bing", darken=2.5, viterbi=T, flight=3)
make_plot(sldf, viterbi, type="bing", darken=2.5, viterbi=T, flight=5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.