Learn R Programming

spatsurv (version 0.9-11)

spplot_compare: spplot_compare function

Description

A function to compare two SpatialPolgonsDataFrame or SpatialPointsDataFrame objects using a unified legend for the variable of interest in both

Usage

spplot_compare(x, y, what, what1 = what, palette = brewer.pal(9, "Oranges"),
  legpos = "topleft", border = NA, fun = identity, t1 = "", t2 = "",
  bw = FALSE, ...)

Arguments

x
a SpatialPolgonsDataFrame or a SpatialPointsDataFrame
y
a SpatialPolgonsDataFrame or a SpatialPointsDataFrame
what
the name of the variable from x to plot
what1
the name of the variable from y to plot. default is to plot the variable of the same name
palette
the palette, can either be a vector of names of colours, or a vector of colours produced for example by the brewer.pal function.
legpos
the position of the legend, options are 'topleft', 'topright', 'bottomleft', 'bottomright'
border
see ?spplot
fun
an optional function of the data to plot, default is the identity function
t1
title for the plot of x
t2
title for the plot of y
bw
Logical. Plot in black/white/greyscale? Default is to produce a colour plot. Useful for producing plots for journals that do not accept colour plots.
...
other arguments to be passed to the plot function

Value

  • produces a plot comparing x[[what]] and y[[what1]]