mapPlants: mapPlants

mapPlantsR Documentation

mapPlants

Description

Produces an .html map from a vector of plot names and a vector of corresponding values.

Usage

mapPlants(
  object,
  plots,
  values,
  maptype = "basic",
  colorgroups = 8,
  radius = 30,
  opacity = 1,
  colortype = "quantile",
  colors = c("cyan", "magenta4", "orangered3"),
  ...
)

Arguments

object

Either an object of class NPSForVeg or a list of such objects

plots

A character vector of plot names.

values

A vector of values to map. Can be either numerical data or categories.

maptype

The type of base map to be used. Options are:

"basic"

The default, uses the basic Park Tiles map, similar to the maps found in park brochures.

"imagery"

The Park Tiles satellite imagery map.

"slate"

The Park Tiles slate map. A very muted and grey base map.

"light"

The Park Tiles light map. A very pale map.

colorgroups

The number of different colors to display for maps with a colortype of "bin" or "quantile", or a series of cut points to be used with colortype="bin" See discussion below.

radius

The radius in meters, of the circle drawn on the map. When the map is zoomed out the circles will be visible regardless of the value chosen.

opacity

Opacity of the circles on the map. A single number from 0 (completely transparent) to 1 (completely opaque). Defaults to 1.

colortype

Indicates the method of assigning colors to each plot. Makes use of the leaflet package's color functions:

"quantile"

Divides the data into the number of groups indicated in colorgroups based on quantiles of the data. An approximately equal number of plots will be in each group. Each group will be given a different color.

"bin"

Divides the data into groups based on the cut function. Like the "quantile" option it divides the plots into groups, but in this case each group should cover an approximately equal range in values of the data. Alternatively if colorgroups is a vector rather than a single number, the elements of the vector will be the cut points separating the groups to be mapped.

"numeric"

Colors the plots based on a smooth color ramp, rather than dividing into groups.

"factor

Used when values are categorical data.

colors

A character vector of one or more colors for the plots on the map. See discussion below.

Details

This function is a wrapper for the leaflet package. It quickly creates a map by plotting the locations of the plots on the ParkTiles base map from the NPS.

Several option exist for coloring the plots based on the colorNumeric, colorBin, colorQuantile, and colorFactor functions in leaflet.

quantile - This option will divide the plots into the equal quantiles based on the data in values. The colorgroups agrument indicates the number of groups the plots will be divided into. For exmple if colorgroups=4 then the plots with the bottom quarter of values will get one color, the second quarter of values will get a second color etc. An error may occur if it is not possible to divide the value vector in to the indicated number of groups. For example, if half of values is the same number, than it cannot be divided into thirds.

bin - This option also divides the plots into groups, but in this case the groups either cover an equal range in values or cover ranges specificed in colorgroups. If colorgroups is a single value, than that will indicate the number of groups to divide values into. For example, if values range from 1 to 100, and colorgroups is 4, the plots with values 1-25 will be one color, 26-50 a second and so on. If instead colorgroups is c(-1,10,50,75,101) then plots from 1-10 will be one color, 11-50 a second and so on.

numeric - This option does not divide the plots into groups. Rather plots will have a smooth ramp of colors from the lowest to the highest value.

factor - This will color the plots when values is categorical data (e.g. soil or vegetation type) rather than numeric. Each category gets a different color.

The colors argument indicates which colors will be chosen for the plots. This is a charcter vector and can either be standard R color names ("blue", "green" etc.) or hexadecimal colors ("#0000FF","008000",etc). If the number of colors is equal to the number of groups then each group will get the corresponding color. If there are fewer colors than groups, then a color ramp will be created using the indicated colors. Typically maps made with the "numeric" option will make use of the color ramp.

Currently there is no legend displayed with the map. However, if you click on a circle it will give you the Plot Name and the value associated with the plot.


NCRN/NPSForVeg documentation built on March 26, 2024, 7:13 a.m.