worldplotCat {WorldMapR}R Documentation

worldplotCat

Description

Plot a world heat map based on a categorical variable.

Usage

worldplotCat(
  data,
  ColName,
  CountryName,
  CountryNameType = "isoa2",
  longitude = c(-180, 180),
  latitude = c(-90, 90),
  crs = 4326,
  title = "",
  legendTitle = as.character(ColName),
  legend.position = "right",
  Categories = levels(factor(map_df$MapFiller)),
  na.as.category = TRUE,
  label.color = "white",
  label.size = 2,
  annote = FALSE,
  div = 1,
  palette_option = "D",
  na_colour = "grey80",
  transform_limits = TRUE,
  shadows = TRUE,
  UK_as_GB = TRUE
)

Arguments

data

Data set containing the list of nations and the variable that we want to plot.

ColName

Character variable with the name of the variable of interest.

CountryName

Character variable with the name of the country names column.

CountryNameType

Character variable with the coding for CountryName. One of isoa2 (default, standing for ISO 3166-1 alpha-2 code), isoa3, or name.

longitude

Longitude limits. Default is c(-180, 180) (whole world with crs as EPSG::4326).

latitude

Latitude limits. Default is c(-90, 90) (whole world with crs as EPSG::4326).

crs

Coordinate reference system (EPSG). By default the value is 4326, which corresponds to EPSG::4326 (WGS84)

title

Title of the plot. Default is no title.

legendTitle

Title of the legend. Default is the name of the filling variable.

legend.position

Position of the legend. If set to "none", no legend is displayed

Categories

categories labels to be plotted in the legend.

na.as.category

Treat NA as a separate category? If 'TRUE, NA will also appear in the legend as one of the categories.

label.color

Color of the labels if annote = TRUE. Default is white

label.size

Size of the labels if annote = TRUE

annote

Do you want to plot country labels (ISO 3166-1 alpha-2 code) on the map? Default is set to FALSE.

div

Parameter for modifying the elements dimensions in the map. Usually, it does not need to be modified. Default value is 1.

palette_option

Character string indicating the palette to be used. Available options range between "A" and "H". You can also enter a string with a colour for each category

na_colour

The colour to be used for countries with missing information. Default is grey80

transform_limits

Only if crs is specified and different from 4326. If TRUE (the default) the program expects to receive values of longitude and latitude as in EPSG 4326, (i.e., within -180, +180 for longitude and within -90, +90 for latitude) and automatically updates to the new crs. Set to FALSE if you want to define longitude and latitude limits based on the new crs

shadows

If TRUE, add shadows to the country labels (only if annote = TRUE)

UK_as_GB

Argument passed to countrycoord_data if annote is set to TRUE. Do you want to translate the GB isoa2 code to UK? If FALSE, GB is returned in the output data.frame. If TRUE (default), UK is returned.

Value

a map

Examples

data(testdata1b)
worldplotCat(data = testdata1b,
             div = 1,
             ColName = "VCat",
             CountryName = "Cshort",
             CountryNameType = "isoa2",
             annote = FALSE)


[Package WorldMapR version 1.2.0 Index]