plotFun.stn: Plot map with stations.

View source: R/plotFun.stn.R

plotFun.stnR Documentation

Plot map with stations.

Description

Plot a map with point stations, either a single plot or multiplot. A common colorbar is set for a multiplot.

Usage

plotFun.stn(data, lon, lat, xlims, ylims, lattice = NULL,
  breaks = NULL, palette = rainbow(10), window.width = 8,
  window.height = 6, title.main = NULL, title.single = NULL,
  unit.text = NULL, mark.border = TRUE, cex.marker = 1,
  cex.main = 1, cex.single = 1, cex.unit = 1, cex.textcbar = 1,
  width.cbar = 0.1, disp.warnings = FALSE, axis.lab = FALSE,
  export = FALSE, export.format = NULL, export.path = NULL,
  text = NULL, cex.text = 1, map.fill = FALSE, map.col = "grey89")

Arguments

data

vector or matrix to be plotted. When it is a matrix, a multiplot is generated (each row of data is plotted in a subplot).

lon

vector of longitudes. It must have the same length as data (or number of columns in data).

lat

vector of latitudes. It must have the same length as data (or number of columns in data).

xlims

2-element vector defining the minimum and maximum longitud for the plotting area.

ylims

2-element vector defining the minimum and maximum latitude for the plotting area.

lattice

in multiple plots, 2-element vector giving the number of rows and columns to display the multiplot.

breaks

vector of values defining the intervals to be used in the colorbar.

palette

character vector with the colors for the plot. They will be interpolated to match the number of intervals defined by breaks.

window.width

sets the width of the device window. Modify this argument to improve the appearance. Default:8.

window.height

sets the height of the device window. Modify this argument to improve the appearance. Default:6.

title.main

character string with the main title.

title.single

(optional): in multiple plots, a character vector with the individual titles for single plots.

unit.text

character string to be placed in the colorbar with the units.

mark.border

logical. If black contour for the cicles is plotted. Default=TRUE.

cex.marker

numeric value giving the marker expansion factor. Default: 1.

cex.main

numeric value giving the title expansion factor. Default: 1.

cex.single

(optional): in multiple plots, numeric value giving the title expansion factor. Default: 1.

cex.unit

numeric value giving the expansion factor of the units text. Default:1.

cex.textcbar

numeric value giving the expansion factor of the text in the colorbar. Default:1.

width.cbar

numeric value giving the fraction of the plot (from 0 to 1) reserved for the colorbar. Modify this argument for a better appearance. Default=0.1

disp.warnings

logical to set if warnings shoul be displayed.

axis.lab

display or not lon/lat ticks and labels. Default=FALSE

export

logical. If TRUE, the figure is exported as pdf file. Default: False.

export.format

"png" or "pdf" format.

export.path

path (including file name) to save the plot.

text

display some text in each point. Length should be the same as lat and lon.

cex.text

numeric value giving the text expansion factor. Default: 1.

map.fill

logical. If map is filled with colour in ‘map.col’. Default: FALSE

map.col

Colour for the map (continent). Default: grey89.

Details

Packages classInt and maps needed.

Author(s)

Ana Casanueva (17.02.2017)

Examples

## Not run: 
# Generate data
tas <- cbind(rnorm(10, mean=15, sd=2), rnorm(10, mean=20, sd=1.5))
longitude = c(6,-5)
latitude = c(46, 40)
# Single plot
plotFun.stn(apply(tas,2, mean, na.rm=T), lon=longitude, lat = latitude, xlims = c(-10,30), 
ylims = c(35,65), width.cbar = 0.2, breaks = seq(10,20), title.main = "Mean Temp.", 
unit.text = "degC", cex.main=1.5, cex.marker = 2)
# Multi-plots
plotFun.stn(tas[1:2,], lon=longitude, lat = latitude, xlims = c(-10,30), ylims = c(35,65), 
width.cbar = 0.15, breaks = seq(10,20), window.height = 10, window.width = 6, 
title.single = c("Temp1","Temp2"), cex.single = 1.3, title.main = "Station plot", cex.main = 2, 
unit.text = "degC")

## End(Not run)

anacv/plotFun documentation built on June 21, 2022, 10:31 p.m.