Learn R Programming

riverdist (version 0.17.0)

densityanomaly: Plot Difference from Mean Kernel Density Using River Distance

Description

Plots kernel density anomaly for each survey, which is defined as the difference between kernel density for each survey and mean kernel density across all surveys. The intent of this function is to highlight areas in which density is higher or lower for specific surveys than it is on average.

The input argument is an object returned from makeriverdensity.

Usage

densityanomaly(
  x,
  whichplots = NULL,
  method = c("overlap", "both", "positive", "negative"),
  negative_ramp = "blue",
  positive_ramp = "red",
  parmfrow = NULL,
  ...
)

Value

NULL

Arguments

x

An object returned from makeriverdensity.

whichplots

A vector of plots to produce, if multiple plots are produced. For example, specifying whichplot=c(2,3,4) will result in only the second, third, and fourth plots of the sequence being produced. Accepting the default (NULL) will result in all plots being produced. Note: this will also be the set of kernel densities used to calculate the mean kernel density and thereby differences from mean kernel density.

method

Whether to produce plots for positive and negative anomalies overlayed ("overlay"), in sequence ("both"), or positive or negative only ("positive" or "negative").

negative_ramp

Color ramp to use for negative anomaly (see plot.riverdensity for more details). Defaults to "blue".

positive_ramp

Color ramp to use for negative anomaly (see plot.riverdensity for more details). Defaults to "red".

parmfrow

Optional argument to par(mfrow)=, which may be useful if method="both". Defaults to NULL.

...

Additional arguments to plot.riverdensity.

Author

Matt Tyers

See Also

makeriverdensity, plot.riverdensity, plotriverdensitypoints

Examples

Run this code
data(Gulk, fakefish)

Gulk_dens <- makeriverdensity(seg=fakefish$seg, vert=fakefish$vert, rivers=Gulk, 
  survey=fakefish$flight.date)
  
# first, the behavior of plot.riverdensity
# # 10 plots will be created, recommend calling par(mfrow=c(2,5))
plot(x=Gulk_dens)

# next, showing densityanomaly
densityanomaly(x=Gulk_dens, parmfrow=c(2,5))
densityanomaly(x=Gulk_dens, method="negative", parmfrow=c(2,5))
densityanomaly(x=Gulk_dens, method="positive", parmfrow=c(2,5))

Run the code above in your browser using DataLab