plotScatter: Make a scatter plot

View source: R/plotScatter.R

plotScatterR Documentation

Make a scatter plot

Description

This simple function makes (and returns it as an object, it doesn't print it) a simple scatter plot (using ggplot2). The data are two layers from either one or two Field objects. Data points which appear in one Field but not the other are excluded

Usage

plotScatter(
  x,
  y = x,
  layer.x,
  layer.y = layer.x,
  alpha = 1,
  text.multiplier,
  tolerance = NULL
)

Arguments

x

The first DGVMTools::Field or Comparison object from which the data to be plotted should be taken.

y

The second DGVMTools::Field or Comparison object from which the data to be plotted should be taken. Default value is x.

layer.x

The first layer to be plotted (taken from x)

layer.y

The second layer to be plotted (taken from y). Defaults to layer.x.

alpha

Numeric between 0 and 1 specifing the transparency of the points. Default is 1 (= fully opaque).

text.multiplier

A number specifying an overall multiplier for the text on the plot. Make it bigger if the text is too small on large plots and vice-versa.

tolerance

Numeric, passed to copyLayers. Defines how close the longitudes and latitudes of the gridcells in x and y (if different) need to be to the coordinates in order to get a match. Can be a single numeric (for the same tolerance for both lon and lat) or a vector of two numerics (for lon and lat separately). Default is no rounding (value is NULL) and so is fine for most regular spaced grids. However, setting this can be useful to force matching of coordinates with many decimal places which may have lost a small amount of precision and so don't match exactly.

Value

A ggplot2 object

Author(s)

Matthew Forrest matthew.forrest@senckenberg.de


MagicForrest/DGVMTools documentation built on Aug. 23, 2024, 8:05 a.m.