autoplot.pr.points: Create a basic plot showing locations of downloaded PR points

View source: R/autoplot.pr.points.R

autoplot.pr.pointsR Documentation

Create a basic plot showing locations of downloaded PR points

Description

autoplot.pr.points creates a map of PR points downloaded from MAP.

Usage

## S3 method for class 'pr.points'
autoplot(
  object,
  ...,
  shp_df = NULL,
  admin_level = "admin0",
  map_title = "PR Survey Locations",
  fill_legend_title = "Raw PR",
  fill_scale_transform = "identity",
  facet = NULL,
  hide_confidential = FALSE,
  printed = TRUE
)

Arguments

object

a pr.points object downloaded using getPR

...

Other arguments passed to specific methods

shp_df

Shapefile(s) (data.frame) to plot with downloaded points. (If not specified automatically uses getShp() for all countries included in pr.points object).

admin_level

the administrative level used for plotting administrative boundaries; either "admin0"; "admin1" OR "both"

map_title

custom title used for the plot

fill_legend_title

Add a title to the legend.

fill_scale_transform

String givning a transformation for the fill aesthetic. See the trans argument in continuous_scale for possible values.

facet

if TRUE, splits map into a separate facet for each malaria species; by default FALSE if only one species is present in object, TRUE if both P. falciparum and P. vivax data are present in object.

hide_confidential

if TRUE, removes confidential points from the map

printed

Should the plot be printed to the graphics device.

Value

autoplot.pr.points returns a plots (gg object) for the supplied pr.points dataframe.

Examples

## Not run: 
PfPR_surveys_NGA <- getPR(country = c("Nigeria"), species = "Pf")
autoplot(PfPR_surveys_NGA)

# Download PfPR2-10 Raster (Bhatt et al. 2015) and raw survey points for Madagascar in
#   2013 and visualise these together on a map.

# Download madagascar shapefile to use for raster download.
MDG_shp <- getShp(ISO = "MDG", admin_level = "admin0")

# Download PfPR2-10 Raster for 2013 & plot this
MDG_PfPR2_10 <- getRaster(surface = "Plasmodium falciparum PR2-10", shp = MDG_shp, year = 2013)
p <- autoplot(MDG_PfPR2_10)

# Download raw PfPR survey points & plot these over the top of the raster
pr <- getPR(country = c("Madagascar"), species = "Pf")
# p[[1]] +
# geom_point(data = pr[pr$year_start==2013,],
#            aes(longitude, latitude, fill = positive / examined,
#                size = examined), shape = 21) +
#   scale_size_continuous(name = "Survey Size") +
#   scale_fill_distiller(name = "PfPR", palette = "RdYlBu") +
#   ggtitle("Raw PfPR Survey points\n + Modelled PfPR 2-10 in Madagascar in 2013")

## End(Not run)


malariaAtlas documentation built on Oct. 27, 2023, 9:07 a.m.