glottomap: Create static and dynamic maps from glottodata, or select...

View source: R/glottomap.R

glottomapR Documentation

Create static and dynamic maps from glottodata, or select languages from a map

Description

With this function you can easily create static and dynamic maps from glottodata (by setting type to 'static' or 'dynamic'). Alternatively, by specifying type = "filter", you can interactively select languages by drawing a shape around them (mode = "draw"; default) or by clicking on them (mode = "click"). See ?glottofiltermap for more details.

Usage

glottomap(
  glottodata = NULL,
  color = NULL,
  label = NULL,
  type = NULL,
  ptsize = NULL,
  alpha = NULL,
  lbsize = NULL,
  palette = NA,
  rivers = FALSE,
  nclass = NULL,
  filename = NULL,
  projection = NULL,
  glotto_title = NULL,
  mode = NULL,
  basemap = "country",
  ...
)

Arguments

glottodata

Optional, user-provided glottodata. In case no glottodata is provided, you can pass arguments directly to glottofilter.

color

glottovar, column name, or column index to be used to color features (optional). See 'Details' below.

label

glottovar, column name, or column index to be used to label features (optional). See 'Details' below.

type

One of: "static", "dynamic", or "filter". Default is "static".

ptsize

Size of points between 0 and 1

alpha

Transparency of points between 0 (very transparent) and 1 (not transparent)

lbsize

Size of labels between 0 and 1

palette

Color palette, see glottocolpal("all") for possible options, and run glottocolpal("turbo") to see what it looks like (replace it with palette name). Alternatively, you could also run tmaptools::palette_explorer(), RColorBrewer::display.brewer.all(), ?viridisLite::viridis, or scales::show_col(viridisLite::viridis(n=20))

rivers

Do you want to plot rivers?

nclass

Preferred number of classes (default is 5)

filename

Optional filename if you want to save resulting map

projection

For static maps, you can choose one of the following: 'eqarea' (equal-area Eckert IV, default), 'pacific' (Pacific-centered), or any other Coordinate Reference System, specified using an EPSG code (https://epsg.io/), for example: "ESRI:54009".

glotto_title

Optional, the title of legend, the default value is the name of the argument color.

mode

In case type = "filter", you can choose here whether you want to interactively select languages by clicking on them (mode = 'click', default) or by drawing a shape around them (mode = 'draw').

basemap

The default basemap is "country", which gives the borders of countries. Alternatively, the basemap can be set to be "hydro-basin", this gives global hydro-basins (Level 03).

...

Additional parameters to glottofilter

Details

If no glottodata object is provided, then you have the following options for the 'color' and 'label' arguments: ', 'glottocode', 'name', 'macroarea', 'isocode', 'countries', 'family_id', 'classification', 'parent_id', 'family', 'isolate', 'family_size', 'family_size_rank', 'country', 'sovereignty', 'type', 'geounit', 'continent', 'adm0_a3', '

Value

a map created from a glotto(sub)data object and can be saved with glottosave()

Examples

## Not run: 
glottomap(country = "Netherlands")

glottopoints <- glottofilter(continent = "South America")
glottopols <- glottospace(glottopoints, method = "voronoi")
glottomap(glottodata = glottopols, color = "family_size_rank")
glottomap(glottodata = glottopols, color = "family", palette = "turbo",
type = "dynamic", label = "name")

glottodata <- glottoget()
families <- dplyr::count(glottodata, family, sort = TRUE)

# highlight 10 largest families:
glottodata <- glottospotlight(glottodata = glottodata, spotcol =
"family", spotlight = families$family[1:10], spotcontrast = "family")

# Or, place 10 largest families in background
glottodata <- glottospotlight(glottodata = glottodata, spotcol =
"family", spotlight = families$family[-c(1:10)], spotcontrast = "family")
glottomap(glottodata, color = "legend")

# Interactive selection by clicking on languages:
selected <- glottomap(continent = "South America", type = "filter")
glottomap(selected)

# Interactive selection by drawing a shape:
selected <- glottomap(continent = "South America", type = "filter", mode = "draw")
glottomap(selected)

## End(Not run)

SietzeN/glottospace documentation built on June 15, 2024, 10:45 p.m.