GeographicMap: Plot a Geographic Map

View source: R/geographicmap.R

GeographicMapR Documentation

Plot a Geographic Map

Description

Creates a map with a table as input, using shading to represent the values of countries or states on the map.

Usage

GeographicMap(
  x,
  country,
  high.resolution = FALSE,
  show.missing.regions = TRUE,
  treat.NA.as.0 = FALSE,
  colors = c("#CCF3FF", "#23B0DB"),
  ocean.color = "#DDDDDD",
  opacity = 1,
  color.NA = "#808080",
  global.font.family = "Arial",
  global.font.color = "#2C2C2C",
  legend.show = TRUE,
  legend.title = "",
  legend.font.family = global.font.family,
  legend.font.color = global.font.color,
  legend.font.size = 14,
  values.hovertext.format = "",
  values.bounds.minimum = NULL,
  values.bounds.maximum = NULL,
  mapping.package = "leaflet",
  background = FALSE,
  title = "",
  title.font.family = global.font.family,
  title.font.color = global.font.color,
  title.font.size = 16,
  subtitle = "",
  subtitle.font.family = global.font.family,
  subtitle.font.color = global.font.color,
  subtitle.font.size = 12,
  footer = "",
  footer.font.family = global.font.family,
  footer.font.color = global.font.color,
  footer.font.size = 8,
  footer.wrap = TRUE,
  footer.wrap.nchar = 100,
  hovertext.font.family = global.font.family,
  hovertext.font.size = 11,
  zip.country = "Automatic"
)

Arguments

x

A matrix, two-dimensional array, table or vector, containing the data to be plotted. The rownames (or names in the case of a vector) should contain the names of the geographic entities to be plotted.

country

Character string optionally stating the country that the states are from, if map.type is "states".

high.resolution

Specifically request a high resolution map. Otherwise the resolution of the map is chosen automatically based on the resolution required for the requested countries or regions.

show.missing.regions

Logical; Whether to plot regions not included in x with values of NA. Used only by "leaflet".

treat.NA.as.0

Plots any NA values in the data and any geographical entities without data as having a zero value.

colors

A vector of two colors, which are used as endpoints in interpolating colors.

ocean.color

The color used for oceans (or background).

opacity

Opacity of bars as an alpha value (0 to 1).

color.NA

The color used to represent missing values. Not used when treat.NA.as.0, is set to missing.

global.font.family

Character; font family for all occurrences of any font attribute for the chart unless specified individually.

global.font.color

Global font color as a named color in character format (e.g. "black") or an rgb value (e.g. #' rgb(0, 0, 0, maxColorValue = 255)).

legend.show

Logical; Whether to display a legend with the color scale.

legend.title

The text to appear above the legend.

legend.font.family

Font family of legend.

legend.font.color

Font color of legend. Only used with plotly object.

legend.font.size

Font size of legend. Changing the defaults for leaflet object can give strange spacing.

values.hovertext.format

A string representing a d3 formatting code. See https://github.com/d3/d3/blob/master/API.md#number-formats-d3-format

values.bounds.minimum

Numeric; specifies the minimum value in the colorscale. If not specified, this will be automatically determined from the data. If the value specified is larger than the minimum in the data then the specified value will be ignored.

values.bounds.maximum

Numeric; specifies the maximum value in the colorscale.

mapping.package

Either "leaflet" (better graphics, wider range of maps) or "plotly" (faster).

background

If "mapping.package" is "leaflet", add a background tile from opensteetmaps.

title

Character; chart title.

title.font.family

Character; title font family. Can be "Arial Black", "Arial", "Comic Sans MS", "Courier New", "Georgia", "Impact", "Lucida Console", "Lucida Sans Unicode", "Marlett", "Symbol", "Tahoma", "Times New Roman", "Trebuchet MS", "Verdana", "Webdings"

title.font.color

Title font color as a named color in character format (e.g. "black") or a hex code.

title.font.size

Integer; Title font size; default = 10.

subtitle

Character

subtitle.font.family

Character; subtitle font family

subtitle.font.color

subtitle font color as a named color in character format (e.g. "black") or an a hex code.

subtitle.font.size

Integer; subtitle font size

footer

Character

footer.font.family

Character; footer font family

footer.font.color

footer font color as a named color in character format (e.g. "black") or an a hex code.

footer.font.size

Integer; footer font size

footer.wrap

Logical; whether the footer text should be wrapped.

footer.wrap.nchar

Number of characters (approximately) in each line of the footer when footer.wrap TRUE.

hovertext.font.family

Font family of hover text.

hovertext.font.size

Only used with plotly object.

zip.country

One of "Automatic", "USA", "UK" or "Australia". If "Automatic" an attempt is made to infer the country from the data.

Value

an HTML widget for "leaflet" or a "plotly" object.

Examples

data <- seq(4)
names(data) <- c("France", "China", "Brazil", "Canada")
GeographicMap(data)

Displayr/flipStandardCharts documentation built on Feb. 26, 2024, 12:42 a.m.