map: Plot maps for esd objects

View source: R/map.R

mapR Documentation

Plot maps for esd objects

Description

Make map of geophysical data. These plot functions are S3 methods for esd objects.

Usage

map(x, ...)

Arguments

x

the object to be plotted; in rotM, x holds a vector of x-coordinates.

...

further arguments passed to or from other methods.

FUN

The function to be applied on x before mapping (e.g. mean)

colbar

The colour scales defined through colscal. Users can specify the colour ‘pal’*ette (‘pal’), the number of breaks (‘n’), values of ‘breaks’, and the position of the color bar from the main plot (‘pos’). The ‘rev’ argument, will produce a reversed color bar if set to TRUE. The other arguments (‘type’,‘h’ and ‘v’) are more specific to col.bar and are used only if argument ‘fancy’ is set to TRUE (not yet finished). colbar=NULL is used if the colourbar is not to be shown. Also use colbar=NULL to present several maps in one figure (e.g. with par(mfcol=c(2,2))).

lab

'default' to show a lable saying what variable (unit) and time period. 'simple' to just use varid(x), and 'unit' to show variable and unit. Other strings will be used as the label for the plot and NULL shows no lable.

it

see subset

is

see subset

new

TRUE: create a new graphic device.

projection

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

xlim

see plot - only used for 'lonlat' and 'sphere' projections. Default xlim=NULL is the same as c(-1,+1) and refers to coordiates on a unit sphere (radius = 1). If plotting should be limited to a range of longitudes and latitudes then subset(.) can be used prior to map.

ylim

see plot - only used for 'lonlat' and 'sphere' projections. See xlim.

n

The number of colour breaks in the color bar

breaks

graphics setting - see image

gridlines

Only for the lon-lat projection

lonR

Only for the spherical projection used by map2sphere to change viewing angle

latR

Only for the spherical projection used by map2sphere to change viewing angle

axiR

Only for the spherical projection used by map2sphere to change viewing angle

style

Only for the spherical projection used by map2sphere to apply night shade effect. c('plain','night')

y

a vector of y coordinates

z

a vector of z coordinates

ip

Selects which pattern (see EOF, CCA) to plot

geography

TRUE: plot geographical features

angle

for hatching

a

used in vec to scale the length of the arrows

r

used in vec to make a 3D effect of plotting the arrows up in the air.

ix

used to subset points for plotting errors

iy

used to subset points for plotting errors

colorbar

Show the color bar in the map (default TRUE). If FALSE, the colorbar is not added into the map (ignored).

cex

Size of symbols.

cex0

Scaling of symbols if cex is defined by a variable with different size for different locations.

cex.subset

...

add.text

Add abbreviated location names.

full.names

Show the full name of the location.

showall

Default is set to FALSE

showaxis

If set to FALSE, the axis are not displayed in the plot.

fancy

If set to true, will use col.bar instead of image to produce the colour bar

text

If TRUE, display text info on the map.The default is set to FALSE

show.val

Display the values of 'x' or 'FUN(x)' on top of the coloured map.

legend.shrink

If set, the size of the color bar is shrinked (values between 0 and 1)

land

if TRUE mask land, else mask ocean

what

What to map: ['eof','field] for EOF pattern or the field

type

- default c('fill','contour') recovered from the EOFs.

fig

see par

add

set add=TRUE if adding the map as a subplot

nbins

number of bins/colour categories

Value

A field object

See Also

map.trajectory vec map.dsensemble

plot.station, showmaps

Examples


# Select stations in ss and map the geographical location 
# of the selected stations with a zoom on Norway.
ss <- select.station(cntr="NORWAY",param="precip",src="GHCND")
map(ss, col="blue",bg="lightblue",xlim = c(-10,30) , ylim = c(50,70), new=FALSE)

## Get NACD data and map the mean values
y <- station.nacd()
map(y,FUN='mean',colbar=list(pal="t2m",n=10), cex=2, new=FALSE)

# Examples of cyclone maps (map.events)
data(storms)
# Subset cyclones from the start of January 2016 lasting a minimum of 10 time steps 
x <- subset(storms,it=c("2016-01-01","2016-01-07"),ic=list(param="trackcount",pmin=10))
# Map with points and lines showing the cyclone centers and trajectories
map(x, type=c("trajectory","points"), col="blue")
## Map with only the trajectory and start and end points
map(x, type=c("trajectory","start","end"), col="red")
## Map showing the cyclone depth (slp at center) as a color scale (rd = red scale)
map(x, param="pcent", type=c('trajectory','start'), 
    colbar=list(pal="rd", rev=TRUE, breaks=seq(980,1000,2)), 
    alpha=0.9, new=FALSE)

# Example showing two maps in one figure:
## Not run: 
rr <- retrieve('~/data/data.ECAD/rr_ens_mean_0.1deg_reg.nc',it=c(2000,2001))
it <- 195
par(mfcol=c(1,2))
attr(rr,'variable') <- 'precip'
map(rr,FUN='mean',new=FALSE,type='fill',colbar=NULL,lab=paste(range(index(rr)),collapse=' - '))
map(subset(rr,it=it),FUN='mean',new=FALSE,type='fill',colbar=NULL,lab=as.character(index(rr)[it]))

## End(Not run)

metno/esd documentation built on April 24, 2024, 9:19 p.m.