Skip to contents

function to create a ggplot for the feeding points or confirmatory signs. This is just a lazy wrapper for beavertools::plot_territories but tidies things up a bit. It is not exaustive and

Usage

plot_other_signs(
  beav_points,
  size = 2.5,
  fill_col = c("#e41a1c", "#4daf4a", "#d11141"),
  label = FALSE,
  basemap = TRUE,
  basemap_type = "osmgrayscale",
  axes_units = TRUE,
  scalebar = TRUE,
  scalebar_loc = "tl",
  north_arrow = TRUE,
  north_arrow_loc = "br",
  north_arrow_size = 0.75,
  wgs = TRUE,
  guide = TRUE,
  guide_pos = "bottom",
  seed = NA,
  drop_act = FALSE,
  trans_type = NULL,
  catchment = NULL,
  rivers = FALSE,
  add_hillshade = FALSE,
  plot_extent = NULL,
  mask_fill = "grey50"
)

Arguments

beav_points

An 'sf' object containing the location of beaver dwellings and dams. Alternative signs will be labelled as 'other'

size

a numeric vector of length 1 denoting the point size to be used by ggplot2.

fill_col

character vector of R colours or HEX codes.

label

label activity areas with polygon ID.

basemap

Boolean, include an OSM basemap. (optional)

basemap_type

Character vector for osm map type. for options see rosm::osm.types()

axes_units

Boolean to include coordinate values on axis.

scalebar

Boolean to include a scalebar.

scalebar_loc

character vector for the scalebar location one of:'tl', 'bl', 'tr', 'br' Meaning "top left" etc.

north_arrow

Boolean to include a north arrow

north_arrow_loc

character vector for the arrow location one of:'tl', 'bl', 'tr', 'br' Meaning "top left" etc.

north_arrow_size

numeric vector for the arrow

wgs

Boolean to transform coordinate reference system (CRS) to WGS84 (EPSG:4326)

guide

Boolean to include a legend

guide_pos

character vector describing the desired position of the guide c("left", "right", "bottom", "top")

seed

numeric seed number -useful if using 'fill_name' = 'ID' as will set the same random colour palette.

drop_act

Boolean to remove areas classified as 'activity' this creates a plot which shows only possibl and confirmed territories

trans_type

character - the transformation type to be used if fill_name=c('mean_fd', sum_fd').

catchment

An sf object or an sf-readable file. See sf::st_drivers() for available drivers. This feature should be a boundary such as a catchment or Area of interest. It is used to mask the map region outside of desired AOI.

rivers

Boolean to include river lines (downloaded automatcally using the osmdata package) OR a river network of class 'sf' which can be generated beforehand using beavertools::get_rivers().

add_hillshade

Boolean to add an osm hillshade background map. This can be combined with 'basemap_type' to create a textured basemap.

plot_extent

'bbox', 'sf' or 'sp' object defining the desired plot extent.

Value

ggplot object of a confirmatory signs map.

Examples

# Here we filter the filter the built in 2019-2020 ROBT confirmatory sign data `RivOtter_OtherSigns`
# Then pipe this 'sf' object to plot_feeding.

RivOtter_OtherSigns %>%
dplyr::filter(SurveySeason == "2019 - 2020") %>%
  plot_other_signs(., size = 1.5,basemap=T, catchment = RivOtter_Catch_Area,
                   rivers = T, plot_extent = inflate_bbox(RivOtter_Catch_Area, 200))
#> Please note that rgdal will be retired during October 2023,
#> plan transition to sf/stars/terra functions using GDAL and PROJ
#> at your earliest convenience.
#> See https://r-spatial.org/r/2023/05/15/evolution4.html and https://github.com/r-spatial/evolution
#> rgdal: version: 1.6-7, (SVN revision 1203)
#> Geospatial Data Abstraction Library extensions to R successfully loaded
#> Loaded GDAL runtime: GDAL 3.4.1, released 2021/12/27
#> Path to GDAL shared files: /usr/share/gdal
#> GDAL binary built with GEOS: TRUE 
#> Loaded PROJ runtime: Rel. 8.2.1, January 1st, 2022, [PJ_VERSION: 821]
#> Path to PROJ shared files: /home/runner/.local/share/proj:/usr/share/proj
#> PROJ CDN enabled: TRUE
#> Linking to sp version:2.0-0
#> To mute warnings of possible GDAL/OSR exportToProj4() degradation,
#> use options("rgdal_show_exportToProj4_warnings"="none") before loading sp or rgdal.
#> Zoom: 11
#> Fetching 12 missing tiles
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======                                                                |   8%
  |                                                                            
  |============                                                          |  17%
  |                                                                            
  |==================                                                    |  25%
  |                                                                            
  |=======================                                               |  33%
  |                                                                            
  |=============================                                         |  42%
  |                                                                            
  |===================================                                   |  50%
  |                                                                            
  |=========================================                             |  58%
  |                                                                            
  |===============================================                       |  67%
  |                                                                            
  |====================================================                  |  75%
  |                                                                            
  |==========================================================            |  83%
  |                                                                            
  |================================================================      |  92%
  |                                                                            
  |======================================================================| 100%
#> ...complete!
#> Error in ggspatial::annotation_map_tile(type = basemap_type, zoomin = 0,     alpha = 0.8): Problem while converting geom to grob.
#>  Error occurred in the 1st layer.
#> Caused by error in `check.dimensions()`:
#> ! Zero tiles were loaded for type osmgrayscale