Title: | Plots Fishery Data into Maps |
---|---|
Description: | Plots georeferenced fishery data into maps. This package uses the power of lattice's levelplot and maps databases from the maps and mapdata packages. |
Authors: | Fernando Mayer [aut, cre] |
Maintainer: | Fernando Mayer <[email protected]> |
License: | GPL-3 |
Version: | 0.3.3 |
Built: | 2025-01-28 02:36:40 UTC |
Source: | https://github.com/fernandomayer/FishMaps |
Skipjack tuna CPUE by year, caught by the brazilian baitboat fleet, based at Itajai (SC) harbor.
data(BB.data.y)
data(BB.data.y)
A data frame with 56 observations on the following 4 variables:
year: a factor with levels 2001
, 2002
lat: a numeric vector
lon: a numeric vector
cpue: a numeric vector
Actually this is some randomly generated data.
data(BB.data.y) str(BB.data.y)
data(BB.data.y) str(BB.data.y)
Skipjack tuna CPUE by quarter and year, caught by the brazilian baitboat fleet, based at Itajai (SC) harbor.
data(BB.data.yq)
data(BB.data.yq)
A data frame with 120 observations on the following 5 variables:
year: a factor with levels 2001
, 2002
quarter: a factor with levels 1
, 2
, 3
, 4
lat: a numeric vector
lon: a numeric vector
cpue: a numeric vector
Actually this is some randomly generated data.
data(BB.data.yq) str(BB.data.yq)
data(BB.data.yq) str(BB.data.yq)
Plots georeferenced fishery data (e.g. catch, effort and CPUE) into maps. This is the lattice version of a previous FishMaps version based on traditional grid graphics.
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.
levelmap(x, data, xlim, ylim, breaks, square = 1, col.land = "snow", key.space = "right", database = c("world", "worldHires"), ...)
levelmap(x, data, xlim, ylim, breaks, square = 1, col.land = "snow", key.space = "right", database = c("world", "worldHires"), ...)
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 [email protected]
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.
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)
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)
Swordfish CPUE by year, caught by the brazilian longline fleet, based at Itajai (SC) harbor.
data(LL.data.y)
data(LL.data.y)
A data frame with 82 observations on the following 4 variables.
year: a factor with levels 2001
, 2002
,
2003
, 2004
, 2005
lat: a numeric vector
lon: a numeric vector
cpue: a numeric vector
Actually this is some randomly generated data.
data(LL.data.y) str(LL.data.y)
data(LL.data.y) str(LL.data.y)
Swordfish CPUE by year and quarter, caught by the brazilian longline fleet, based at Itajai (SC) harbor.
data(LL.data.yq)
data(LL.data.yq)
A data frame with 181 observations on the following 5 variables:
year: a factor with levels 2001
, 2002
,
2003
, 2004
, 2005
quarter: a factor with levels 1
, 2
, 3
,
4
lat: a numeric vector
lon: a numeric vector
cpue a numeric vector
Actually this is some randomly generated data.
data(LL.data.yq) str(LL.data.yq)
data(LL.data.yq) str(LL.data.yq)
A lattice panel function to draw rectangles where z is different from zero and to draw points where z is exactly zero.
panel.fishmaps(x, y, z, map.db, msq, breaks, col.land, col.reg, labsx, labsy, subscripts, ...)
panel.fishmaps(x, y, z, map.db, msq, breaks, col.land, col.reg, labsx, labsy, subscripts, ...)
x |
From lattice formula x. |
y |
From lattice formula y. |
z |
From lattice formula z. |
map.db |
The map database. |
msq |
The middle of squares defined in argument |
breaks |
The |
col.land |
The land color, from |
col.reg |
The color regions, from |
labsx |
The x axis ticks and labels. |
labsy |
The y axis ticks and labels. |
subscripts |
Lattice panel subscripts. |
... |
Other arguments passed to lattice panel functions. |
All arguments used here are defined in the source of the
levelmap
function.
Fernando Mayer [email protected]
A lattice panel function to plot special characters to maps when data is zero.
panel.zero.points(x, y, z, subscripts, ...)
panel.zero.points(x, y, z, subscripts, ...)
x |
From lattice fomrmula x. |
y |
From lattice fomrmula y. |
z |
From lattice fomrmula z. |
subscripts |
Lattice panbel subscripts. |
... |
Other arguments passed to lattice panel functions. |
Fernando Mayer [email protected]
Creates the ticks and labels to print in the maps. This is an internal function.
xyticks(xlim, ylim, square)
xyticks(xlim, ylim, square)
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. |
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. |
A list with 4 components, to be used in levelmap.
Fernando Mayer [email protected]