parallelMaps: Make plots with parallel effect

View source: R/parallelMaps.R

parallelMapsR Documentation

Make plots with parallel effect

Description

This function takes a data.frame of coordinates and uses a 'group' column to make a plot placing the points in a parallel way.

Usage

parallelMaps(
  x,
  overlay = 0,
  direction = 2,
  labels.args = list(),
  map.args = list(),
  final.par = list(),
  saveFig = FALSE,
  png.args = list(),
  extra.args = list(res = 450, width = 2000),
  xlim = NULL,
  ylim = NULL,
  col = "black",
  pch = 1,
  cex = 1,
  interpolate = FALSE,
  show.axis.labels = TRUE,
  pos.axis.labels = ifelse(direction%%2 == 0, 2, 1),
  axis.labels.args = list(),
  quiet = FALSE,
  extra.elements.bf = NULL,
  extra.elements.af = NULL,
  ...
)

Arguments

x

data.frame with coordinates and group column.

overlay

numeric value indicating the level of overlay between subplots ([0; 0.5>).

direction

numeric On which side of the plot (1 = bottom, 2 = left, 3 = top, 4 = right) the subplots will be placed?

labels.args

Extra arguments for mtext that is used to specify the labels of groups. If NULL, labels will not be plotted.

map.args

Extra arguments for map that is used to add map shapes to subplots. If NULL, map lines will not be plotted.

final.par

list with graphical settings applied to the final plot. See the available options in par.

saveFig

logical Do you want to save final plot as a .png file? If saveFig = TRUE (default), the plot will not be showed.

png.args

logical If saveFig = TRUE, extra arguments passed to png.

extra.args

Extra arguments passed to some internal steps. See Details.

xlim, ylim

numeric Range of subplots in X and Y axis.

col, pch, cex

Features that will vary by groups.

interpolate

a logical vector (or scalar) indicating whether to apply linear interpolation to the image when drawing. Argument passed from rasterImage.

show.axis.labels

logical that defines if the axis labels will be plotted.

pos.axis.labels

If show.axis.labels = TRUE, this arguments indicates the position of the axis labels.

axis.labels.args

If show.axis.labels = TRUE, extra arguments passed to axis.

quiet

logical value to control informative messages.

extra.elements.bf, extra.elements.af

Adicional elements could be included in the subplots (by group) by this argument: extra.elements.bf for including elements before drawing the points, otherwise extra.elements.af. See Details.

...

Extra arguments passed to plot that makes subplots.

Details

x must be defined as a data.frame with at least 3 columns: lon, lat and group. It is recommended that to define group as a factor, otherwise, it will be defined internaly as it using as.factor.

This function plots and saves internaly one figure per group. The quality of this subplots can be modified by extra.args setting res (default 200) and width in pixels (default 2500).

extra.elements.bf and extra.elements.af receive pieces of code that will be placed and run before or after the drawing of points. The order of drawing is an empty canvas, the extra.elements.bf-elements, the points, the map, the labels of groups, and the extra.elements.af-elements.

Value

Depending on saveFig and plot values, this function will return a plot

Examples

data(coord_example)

parallelMaps(x = coord_example, direction = 2, overlay = 0.1,
             xlim = c(-82, -74), ylim = c(-16, -4),
             labels.args = list(adj = 0.5, side = 1),
             col = adjustcolor(c("blue", "red", "forestgreen", "gold2"), 0.5),
             pch = c(15, 16, 17, 18),
             map.args = list(database = "worldHires"),
             extra.elements.bf = {
               abline(h = -6, col = "purple")
               abline(h = -14, col = "gold4")})

LuisLauM/ruisu documentation built on March 26, 2024, 8:23 a.m.