plotmap: plots landmask of a defined region

Description Usage Arguments Details Author(s) See Also Examples

View source: R/plotmap.r

Description

plots the landmask of a region defined by a region-key word, georgraphical coordinates (longitude and latitude), a raster- or extent-object. See add.region to add and save new region definitions. Attention! Unlike add.region, plotmap does not include colorbar placement (see: set.colorbar)

Usage

1
2
3
4
5
6
plotmap(region=v_area, lon, lat, add=F, asp,
        grid=T, grid.res, resolution=0, 
        main, axes=T, axeslabels=axes, ticklabels=T, cex.lab=0.8, cex.ticks=0.8, 
        fill.land=T, col.land="grey", col.bg=NA, border='black', bwd=2, las=1, 
        v_area, xlim, ylim
        )

Arguments

region, v_area

Character string identifying regions predefined by the region_definitions-dataset, Raster* or Extent object (corresponds to v_area of the v-function). If missing, region is derived from geographical coordinates, denoted by lat and lon. See add.region to define new region definitions and delete.region to delete unproper region definitions.

lon, xlim

Vector returning longitude coordinates of the area to be plotted.

lat, ylim

Vector returning latitude coordinates of the area to be plotted.

add

whether the a the landmask should be added to an existent figure (default is FALSE)

asp

numeric, giving the aspect y/x-ratio of the y- and x-axes. See plot.window for more details.

main

title to be plotted

axes, axeslabels

whether axes and axes-labels (longitude and latitude) should be plotted (default is TRUE). axes-labels can be a single value or a vector of size two, representing values for x and y axis, respectively.

ticklabels

whether tick-labels should be added to the axes (default is TRUE). Can be a single value or a vector.

cex.lab

font size of axis labels

cex.ticks

font size of tick labels

grid

whether a grid should be plotted (default is TRUE)

grid.res

resolution of the grid, in degrees (default is is derived from the region extent)

resolution

number that specifies the resolution with which to draw the map. Resolution 0 is the full resolution of the database [default]. Otherwise, just before polylines are plotted they are thinned: roughly speaking, successive points on the polyline that are within resolution device pixels of one another are collapsed to a single point (see the Reference for further details). Thinning is not performed if plot = FALSE or when polygons are drawn (fill = TRUE or database is a list of polygons).

bwd

width is of the axes bars (default is 1)

fill.land

whether the a the landmask should be filled by a color (default is TRUE)

col.land

fill color of the landmask to be plotted (default is grey)

col.bg

background color (ocean) to be plotted (default is NA)

border

country border color of the landmask to be plotted (default is black)

las

numeric in 0,1,2,3; the style of axis labels.

0: always parallel to the axis,

1: always horizontal [default],

2: always perpendicular to the axis,

3: always vertical

Details

plotmap uses the maps and maptools functions to plot the landmask.

Author(s)

Robert K. Bauer

See Also

v, regions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#### Example 1: plot landmask of the Mediterranean Sea
## a) by using longitude and latitude coordinates:
lon <- c(-6, 37)
lat <- c(30, 46)
figure(width=9.75,height=5.28)
plotmap(lon=lon, lat=lat, main="Mediterranean Sea")
plotmap(xlim=lon, ylim=lat, main="Mediterranean Sea")

## b) plot landmask of the Mediterranean Sea by using an extent-object:
library('raster')
ext <- extent(lon, lat)
# plotmap(ext, main="Mediterranean Sea") # extent-object

## c) plot landmask of the Mediterranean Sea by using a raster-object:
r <- raster(ext)
# plotmap(r, main="Mediterranean Sea") # raster-object

## d) plot landmask of the Mediterranean Sea by using a region label:
plotmap('med4', main="Mediterranean Sea") # region-label
# regions() ## check preinstalled region label

## e) add landmask to an existing plot:
plot(3.7008, 43.4079, xlim=lon, ylim=lat)
plotmap(add=T)
points(3.7008, 43.4079, pch=19)


#### Example 2: subplots and some additional arguments of plotmap()
par(mfrow=c(2, 1))
plotmap('medw4', main="Western Mediterranean Sea",col.bg="darkblue")
plotmap('medw4', main="Western Mediterranean Sea", bwd=3, border='grey', grid=FALSE)


#### Example 3: plotmap() and figure()
do.save <- FALSE ## open a plotting window
figure("Gulf_of_Lions_extended", do.save=do.save, width=5, height=5, type="pdf")
plotmap("lion",col.bg='darkblue',grid=FALSE)
close_fig(do.save)

## now resize figure manually and get new figure dimensions:
# width <- dev.size()[1]
# height <- dev.size()[2]

# do.save <- TRUE ## do NOT open a plotting window, but save figure internally
# figure("Gulf_of_Lions_extended", do.save=do.save, width=width, height=height, type="pdf")
# plotmap("lion",col.bg='darkblue',grid=FALSE)
# close_fig(do.save)


#### Example 4: between hemispheres
# par(mfrow=c(2,1))
# plotmap(lon=c(-180, 180), lat=c(-80, 80), main="map from West to East")
# plotmap(lon=c(0, 360), lat=c(-80, 80), main="map from West to East")
# plotmap(lon=c(-360, 00), lat=c(-80, 80), main="map from West to East") # same as before

#### Example 5: plot bathymetry and topography of the western Mediterranean Sea
#get.bathy("medw4",visualize=T,terrain=T,res=3)
#get.bathy("medw4",visualize=T,terrain=F,res=3,levels=c(200,2000)) # show contours
#get.bathy("lion",visualize=T,terrain=F,res=3,levels=c(200,2000),v_image=F) # show only contours

#### Example 6: testing some additional arguments
# lon <- c(-180,200); lat <- c(-80,90); 
# ext <- extent(lon, lat)
# plotmap(ext, border=NA, bwd=NA, grid=FALSE, col.land = "#9ac0cd",axes=FALSE)

oceanmap documentation built on March 23, 2020, 5:06 p.m.

Related to plotmap in oceanmap...