levelmap: Plots Fishery Data into Maps.

Description Usage Arguments Details Value Author(s) Source See Also Examples

Description

Plots georeferenced fishery data (e.g. catch, effort and CPUE) into maps. This function uses the lattice::levelplot to draw a _level_plot _map_ based on latitude and longitude, with a resolution defined by the size of lat/long squares (e.g. 1x1 or 5x5 degrees). Coastlines are drawn to display the map, based on two databases: maps::world (lower resolution) and mapdata::worldHires (higher resolution), although none of these packages are required since the databases are incorporated inside FishMaps.

Usage

1
2
levelmap(x, data, xlim, ylim, breaks, square = 1, col.land = "snow",
  key.space = "right", database = c("world", "worldHires"), ...)

Arguments

x

A lattice fomula interface, usually z ~ x + y where z is the response variable to be plotted, x are the longitude points, and y are the latitude points. It is really important that the longitude and latitude points are centered in the middle of the squares. See Details. Alternativelly the formula generally is of the form z ~ x + y | c1 + c2 where c1 and c2 are conditioning variables, i.e. the plots will be generated for each combination of c1 and c2 (c1 and c2 could be, for example, year and quarter). See more details about lattice formula interface at levelplot.

data

A data frame where the variables in the formula interface (x) are contained.

xlim

The x limits for the map. Usually this will be the longitude limits.

ylim

The y limits for the map. Usually this will be the latitude limits.

breaks

A numeric vector of cut points, where the data in z should be cutted to form the classes.

square

Size of the square. It must be a length one numeric vector (e.g. for squares of 1x1 degrees, this should be 1). Roughly speaking this can be viewed as the resolution of the map.

col.land

The color of land in map. Any valid color in R is accepted, see colors. By default it's "snow", a pale light color.

key.space

The location or the colorkey (legend) of the map. Can be one of "left", "right", "top" and "bottom". Defaults to "right".

database

The maps database to be used to plot the coastlines. Can be one of "world" (lower resolution) or "worldHires" (higher resolution). Defaults to "world".

...

Other arguments passed to levelplot.

Details

Given a defined resolution of your data, in which here I will call a square, the latitude and longitude points must be centered in the middle of the squares.

Example 1: if your data is in a resolution of 1x1 degrees, then to plot data correctly the latitude and longitude points must be centered such as -27.5/-47.5 for the square with edges -27.0/-47 (lat/long), and use the argument square = 1.

Example 2: if your data is in a 5x5 degree squares, then you should have -27.5/-42.5 for the square with edges -25.0/-40.0 (lat/long), and use the argument square = 5.

Value

A figure with the map(s) and the data plotted in levels.

Author(s)

Fernando Mayer fernandomayer@gmail.com

Source

The databases "world" and "worldHires" were extracted from the databases of the same names in packages maps and mapdata, respectively. These databases are from the CIA World Data Bank II, which are in public domain and currently (mid-2003) available at http://www.evl.uic.edu/pape/data/WDB.

See Also

levelplot, xyplot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
levelmap(cpue ~ lon + lat | year, data = BB.data.y,
         xlim = c(-60, -40), ylim = c(-35, -20),
         key.space = "right", database = "world",
         breaks = pretty(BB.data.y$cpue), square = 1)

levelmap(cpue ~ lon + lat | year + quarter, data = BB.data.yq,
         xlim = c(-60, -40), ylim = c(-35, -20),
         key.space = "right", database = "world",
         breaks = pretty(BB.data.yq$cpue), square = 1)

levelmap(cpue ~ lon + lat | year, data = LL.data.y,
         xlim = c(-60, -20), ylim = c(-50, -10),
         key.space = "right", database = "world",
         breaks = pretty(LL.data.y$cpue), square = 5)

levelmap(cpue ~ lon + lat | year + quarter, data = LL.data.yq,
         xlim = c(-60, -20), ylim = c(-50, -10),
         key.space = "right", database = "world",
         breaks = pretty(LL.data.yq$cpue), square = 5)

fernandomayer/FishMaps documentation built on May 16, 2019, 12:48 p.m.