Description Usage Arguments Details Value Author(s) Source See Also Examples
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.
1 2 |
x |
A lattice fomula interface, usually |
data |
A data frame where the variables in the formula
interface ( |
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
|
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 |
key.space |
The location or the colorkey (legend) of the
map. Can be one of |
database |
The maps database to be used to plot the
coastlines. Can be one of |
... |
Other arguments passed to
|
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.
A figure with the map(s) and the data plotted in levels.
Fernando Mayer fernandomayer@gmail.com
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.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.