Package 'FishMaps'

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

Help Index


Baitboat yearly aggregated data

Description

Skipjack tuna CPUE by year, caught by the brazilian baitboat fleet, based at Itajai (SC) harbor.

Usage

data(BB.data.y)

Format

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

Source

Actually this is some randomly generated data.

Examples

data(BB.data.y)
str(BB.data.y)

Baitboat quarterly aggregated data

Description

Skipjack tuna CPUE by quarter and year, caught by the brazilian baitboat fleet, based at Itajai (SC) harbor.

Usage

data(BB.data.yq)

Format

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

Source

Actually this is some randomly generated data.

Examples

data(BB.data.yq)
str(BB.data.yq)

Plots Fishery Data into Maps.

Description

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 Fishery Data into Maps.

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

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 [email protected]

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

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)

Longline yearly aggregated data

Description

Swordfish CPUE by year, caught by the brazilian longline fleet, based at Itajai (SC) harbor.

Usage

data(LL.data.y)

Format

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

Source

Actually this is some randomly generated data.

Examples

data(LL.data.y)
str(LL.data.y)

Longline quarterly aggregated data

Description

Swordfish CPUE by year and quarter, caught by the brazilian longline fleet, based at Itajai (SC) harbor.

Usage

data(LL.data.yq)

Format

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

Source

Actually this is some randomly generated data.

Examples

data(LL.data.yq)
str(LL.data.yq)

A lattice panel function

Description

A lattice panel function to draw rectangles where z is different from zero and to draw points where z is exactly zero.

Usage

panel.fishmaps(x, y, z, map.db, msq, breaks, col.land, col.reg, labsx, labsy,
  subscripts, ...)

Arguments

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 square in levelmap.

breaks

The breaks argument from levelmap.

col.land

The land color, from levelmap.

col.reg

The color regions, from levelmap.

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.

Details

All arguments used here are defined in the source of the levelmap function.

Author(s)

Fernando Mayer [email protected]


A lattice panel function

Description

A lattice panel function to plot special characters to maps when data is zero.

Usage

panel.zero.points(x, y, z, subscripts, ...)

Arguments

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.

Author(s)

Fernando Mayer [email protected]


Creates the ticks for the maps.

Description

Creates the ticks and labels to print in the maps. This is an internal function.

Usage

xyticks(xlim, ylim, square)

Arguments

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.

Value

A list with 4 components, to be used in levelmap.

Author(s)

Fernando Mayer [email protected]