glottoplot: Visualize glottodata or glottodistances

View source: R/glottoplot.R

glottoplotR Documentation

Visualize glottodata or glottodistances

Description

This function offers different types of visualizations for linguistic data and linguistic distances.

Usage

glottoplot(
  glottodata = NULL,
  glottodist = NULL,
  type = NULL,
  glottonmds = NULL,
  color = NULL,
  ptsize = NULL,
  label = NULL,
  filename = NULL,
  palette = NULL,
  k = NULL,
  na.rm = FALSE,
  row2id = NULL,
  preventoverlap = FALSE,
  alpha = NULL,
  colorvec = NULL,
  expand = NULL,
  lbsize = NULL,
  ptshift = NULL,
  lbshift = NULL
)

Arguments

glottodata

glottodata table

glottodist

A dist object created with glottodist

type

The type of plot: "heatmap", "nmds", or "missing". Default is heatmap if nothing is provided.

glottonmds

A glottonmds object created with glottonmds

color

Name of variable to be used to color features (optional). See 'Details' below.

ptsize

Size of points between 0 and 1 (optional)

label

Name of variable to be used to label features (optional). See 'Details' below.

filename

Optional filename if output should be saved.

palette

Name of color palette, use glottocolpal("all") to see the options

k

Number of dimensions. Either 2 or 3 for nmds.

na.rm

Whether na's should be removed (default is FALSE)

row2id

In case of nmds, specify what each row contains (either 'glottocode' or 'glottosubcode')

preventoverlap

For nmds with 2 dimensions, should overlap between data points be prevented?

alpha

For nmds with 2 dimensions: Transparency of points between 0 (very transparent) and 1 (not transparent)

colorvec

Vector specifying colors for individual values and legend order (non-matching values are omitted), for example: c("Arawakan" = "rosybrown1", "Yucuna" = "red", "Tucanoan" = "lightskyblue1", "Tanimuca-RetuarĂ£" = "blue", "Naduhup" = "gray70", "Kakua-Nukak" = "gray30")

expand

Optionally expand one or all of the axes. Default is c(0,0,0,0), referring to respectively xmin, xmax, ymin, ymax. If you want to change the maximum of the x-axis, you would do: c(0,1,0,0).

lbsize

Label size (optional)

ptshift

(optional) If preventoverlap is TRUE, how much should points be shifted?

lbshift

(optional) If preventoverlap is TRUE, how much should labels be shifted? See the 'values' argument in ggplot2::scale_color_manual() for details.

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 visualization of a glotto(sub)data, glottodist or glottonmds object, which can be saved with glottosave()

Examples


# Plot glottodist as nmds:
glottodata <- glottoget("demodata", meta = TRUE)
glottodist <- glottodist(glottodata = glottodata)
# glottoplot(glottodist = glottodist, type = "nmds",
#  k = 2, color = "family", label = "name", row2id = "glottocode")

# To create a stress/scree plot, you can run:
# goeveg::dimcheckMDS(matrix = as.matrix(glottodist), k = k)


# Plot missing data:
glottodata <- glottoget("demodata", meta = TRUE)
glottodata <- glottosimplify(glottodata)
glottoplot(glottodata = glottodata, type = "missing")


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