map.trajectory: Plot trajectory maps

View source: R/map.trajectory.R

map.trajectoryR Documentation

Plot trajectory maps

Description

map.trajectory is an S3 method for making different types of trajectory maps. By default, map.trajectory shows individual trajectories, but the number density of trajectories can also be visualised by using the argument type='denisty'.

Usage

## S3 method for class 'trajectory'
map(
  x,
  it = NULL,
  is = NULL,
  type = "trajectory",
  param = NA,
  projection = "lonlat",
  verbose = FALSE,
  ...
)

Arguments

x

the trajectory object to be plotted.

it

A list or data.frame providing time index, e.g. month

is

A list or data.frame providing space index, e.g. station record

type

type of map: 'paths' shows trajectories; 'density' shows the spatial density of the trajectories; 'colors' shows colored trajectories where the colorscale represents 'param'; 'anomaly' or 'shape' show only the longitude and latitude displacement of the trajectories

projection

Projections: c("lonlat","sphere","np","sp") - the latter gives stereographic views from the North and south poles.

parameter

to display as a color scale

col

color of trajectories

colmap

Colour scales, either as an output from rgb or a single character string 'bwr' (blue-white-red) or 'rwb' ('red-white-blue')

new

TRUE: create a new graphics device

xlim

see plot - only used for 'lonlat' projection

ylim

see plot - only used for 'lonlat' projection

main

an overall title for the plot

lonR

Only for the spherical projection - see map2sphere

latR

Only for the spherical projection - see map2sphere

leg

logical. If TRUE, legend is shown.

alpha

factor modifying the opacity alpha; typically in [0,1]

Details

The functions hexbin.trajectory and sunflower.trajectory produce alternative versions of trajectory density maps.

See Also

map map.events

Examples


# plot storm tracks zoomed in on the north Atlantic and northern Europe
data(imilast.M03)
map(imilast.M03,col="blue",alpha=0.1,
    projection='latlon',xlim=c(-60,60),ylim=c(30,90),
    new=FALSE)

# spherical projection
map(imilast.M03,col="blue",alpha=0.1,projection='sphere',new=FALSE)

# Quick way of plotting the number density for grid boxes 
# of the width 2 degrees (dx) and height 1 degree (dy).
map(imilast.M03,type="hexbin",xlim=c(-60,60),ylim=c(30,90),dx=2,dy=1,new=FALSE)
map(imilast.M03,type="sunflower",xlim=c(-60,60),ylim=c(30,90),dx=2,dy=1,new=FALSE)

## Not run: 
# Calculate and plot the cyclone density - this takes a little while
cdens <- as.field(imilast.M03)
map(cdens,new=FALSE)

## End(Not run)


metno/esd documentation built on May 4, 2024, 10:58 p.m.