map: Draw map of one or more species from one plot.

Description Usage Arguments Details Examples

Description

Function to draw map of one or more species from one plot. Must give the complete plot dataset, in split format (list of one dataframe per species), and one or more species code. Other arguments are optional, however, many defaults can be adjusted to get a good map on the screen or exported. This calls the functions maptopo() and map1species() for the actual mapping.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
map(splitdatafile, species, spplist = NULL, plotdim = c(1000, 500),
  xrange = c(0, plotdim[1]), yrange = c(0, plotdim[2]),
  elevdata = NULL, cutoff = c(10, 100, 300, 3000), size = NULL,
  deadtree = FALSE, maintitle = "", titlepos = c(plotdim[1]/2, 1.32 *
  plotdim[2]), clrs = NULL, bw = FALSE, bgcolor = "white",
  symbols = NULL, xaxis = TRUE, yaxis = TRUE, addlegend = TRUE,
  legpos = c(plotdim[1]/2, 1.16 * plotdim[2]), legsize = 0.75,
  labsize = 1.15, axisdiv = 100, bty = "n", ht = 6, wd = 9,
  plotside = 6, axspos = 0.5, topoclr = "gray80", topoint = 0,
  export = "no", filepath = "", outfile = NULL)

Arguments

splitdatafile

A full plot dataset in list format (see ?split_data).

species

One or more species codes to be mapped.

spplist

A table with species codes and Latin names can be submitted as well, so that the full genus-species is added to plot. This must have species codes as row names. It should be the CTFS R format species table (eg, bciex::bci_species). It can be set to NULL if not available, then only the species code (as submitted) appears on the map.

plotdim

The x and y dimensions of the plot.

xrange, yrange

Minimum and maximum x and y coordinates of area graphed. If NULL, all x (or y) are included.

elevdata

Elevation data can be submitted, then a topo map is overlaid. Elevation data must be submitted as a matrix (as described in readelevdata in utilities.r).

cutoff

Diameter breaks for changing size of plotting points.

size

The size of plotting points, to match the number of diameter breaks. If NULL, a default set is assigned. This can require fiddling, as big points do not work for really abundant species, and small points for rare species.

deadtree

Set NULL to map all trees, alive and dead; TRUE for dead only, FALSE for live only (relies on status in the R table).

maintitle

A title to appear at the top of the page, above the species name.

titlepos

The position to place the title. The default is above the center of the plot, higher than the species name. It may require some fiddling on different screens to get it the right distance above.

clrs

A vector of color names, one for each species. If set to NULL, default values are assigned. See bw.

bw

If TRUE, only black, white, and grays are used.

bgcolor

The background color. Defaults to white. For presentation exports, try bgcolor="transparent".

symbols

A vector of symbols, one per species. Can be anything accepted by R for pch (plot character in the function plot()). If NULL, defaults are assigned.

addlegend, legpos, legsize

For the species name, whether to include, where to place, and font size. Try the defaults first before fiddling, or just set addlegend=FALSE to remove.

labsize

Size of axis labels.

axisdiv

the division between tick marks; must be a vector of 2, first for x ticks then for y ticks

bty

Type of box to appear around species name. The default, 'n', means no box; set to 'o'to see the box.

ht, wd

Height and width of the overall graph. The default work for pdf export or mapping to the screen, and ht and wd are inches. But if export is png, jpg, emf, height and width are pixels and need to be 500-1000.

plotside

The vertical dimension (inches) of the map.

axspos

Distance between axis numbers and axis.

topoclr

Color of topolines.

topoint

Interval for topolines, if elevdata are submitted.

export

export = "no", does nothing, so the next graph uses the default R device. With this option, the size of the graph cannot have been set larger than the default size, which is usually 7 inches. export = "unix", a new graphics window in unix, size h and width w, will be opened allowing you to alter the size of the output. export = "windows", or export = "mac" are similar to export = "unix" but for windows and mac. export = format exports the graph to a specific file format: "pdf", "png", "jpg", "bmp", "emf".

filepath

The folder to which map will be exported.

outfile

Filename for output.

Details

A common problem is graph size, leading to an error message "Plot region too large". This happens if the export="no" option is used with the option plotside too large for the default graph size (usually 7 inches). If you use the option export="Windows", "Mac", or "Unix", then height and width can be set with arguments ht, wd, and plotside can be as large as you please.

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
## Not run: 

# If you have saved split formatted data:  
CTFSplot(plot = 'bci',
  census = 6,
  type = 'split')

# If you have not saved:

CTFSplot(plot = 'bci', census = 6)

split6 = split_data(censdata = bciex::bci12t6mini, splitcol = 'sp')

nospp = length(species)

map(splitdatafile = split6, species = 'poular')

map(
  splitdatafile = split6,
  species = 'poular',
  export = 'pdf',
  filepath = '~/data/maps/',
  outfile = 'Poulsenia1995map',
  plotside = 10,
  ht = 8.5,
  wd = 11
)

map(splitdatafile = split6,
  species = c('guatdu', 'poular'))

## End(Not run)

forestgeo/ctfs documentation built on May 3, 2019, 6:44 p.m.