worldplotCat {WorldMapR}R Documentation

worldplotCat

Description

Plot a world heat map based on a categorical variable.

Usage

worldplotCat(
  data,
  ColName,
  CountryName,
  CountryNameType,
  longitude = c(-180, 180),
  latitude = c(-90, 90),
  title = "",
  legendTitle = as.character(ColName),
  Categories = levels(factor(map_df$MapFiller)),
  na.as.category = TRUE,
  annote = FALSE,
  div = 1,
  palette_option = "D",
  save = FALSE,
  filename = "worldplot.jpg",
  path = tempdir(),
  width = 20,
  height = 10,
  units = "cm",
  scale = 1
)

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), isoa3, or name.

longitude

Longitude limits. Default is c(-180, 180) (whole world).

latitude

Latitude limits. Default is c(-90, 90) (whole world).

title

Title of the plot. Default is no title.

legendTitle

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

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.

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

save

Save the plot in a jpg file?

filename

Only if is save set to TRUE. Name of the file.

path

Only if save is set to TRUE. Path of the directory where the file is to be saved.

width

Only if save is set to TRUE. Width of the file.

height

Only if save is set to TRUE. Height of the file.

units

Only if save is set to TRUE. Units for width and height. Can be 'cm', 'mm', 'in', or 'px'.

scale

Only if save is set to TRUE. Scaling factor for adjusting image dimensions.

Value

a map

Examples

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


[Package WorldMapR version 0.1.1 Index]