lmap: Drawing multi-level maps (e.g. semantic maps or linguistic...

Description Usage Arguments Details Value Author(s) Examples

View source: R/lmap.R

Description

A multi-level map ("l-map") is a plot of the distribution of nominal data with multiple levels in space. Such visualisations have two direct use-case in linguistics, viz. semantic maps and isoglosses. The drawing if the lines in space is performed by interpolation in this function (see details).

Semantic maps (Haspelmath 2003) are a visualisation of linguistic diversity. A semantic map shows a predefined configuration of functions/senses in two-dimensional space with an overlay of language-specific encoding of these functions/senses. An level-map tries to emulate this linguistic visualiation in an automatic fashion with various options for visual presentation.

Isoglosses show lines surrounding similar phenomena in space. Instead of drawing an exact boundary around measured points, an interpolation-technique is used here to show areas of interest. By only showing boundaries, multiple phenomena can be shown in one graphic.

Usage

1
2
3
4
5
lmap(points, data,
   main = NULL, draw = 5, levels = c(0.41, 0.46, 0.51),
   labels = NULL, cex = 0.7, col = "rainbow", add = FALSE, lambda = NA,
   legend = TRUE, position = "bottomleft", cex.legend = 0.7, font = "",
   note = TRUE, file.out = NULL, ...)

Arguments

points

Coordinates of the data points specified as a two-column matrix or dataframe.

data

Language data to be plotted as contour-overlay over the points. Either specified as a vector of language-specific forms, or as a numeric matrix with the forms as columns and the points as rows (the language-specific forms should be specified as colnames). The values in the matrix designate the occurrence of the forms, allowing for the encoding of frequency/typicality and of overlap of different forms being used in the same function. see Details.

main

Title for the plot

draw

Which forms to be drawn by contours. Specifying a numeric value will only draw the uppermost frequent forms in the data, by default only the topmost five forms are drawn (automatically ordered by frequency). Alternatively, a vector with names or column-indices of the forms to be drawn can be specified.

levels

height of contours to be drawn. Internally, all values are normalized between zero and one, so only values between those extremes are sensible. Line thickness is automatically balanced.

labels

Optionally, labels for the points to be drawn instead of symbols in the plot.

cex

Character expansion of the labels (see previous option). Also influences the size of symbols or pie-charts.

col

Colour specification, either in the form of the name of a built-in color palettes, like rainbow, or a manually specified vector of colors. When NULL, an attempt is made to use grey-scales.

add

Logical: should the plot be added to an exitings plot or not?

lambda

Parameter for the interpolation, passed internally to the function Krig. Low values result in more detailed boundaries around the measured points.

legend

Logical: should a legend be added?

position

Where should the legend be positioned? Passed internally to legend.

cex.legend

Character expansion passed to legend, and also used for the indication of the levels in the plot

font

Font to be used for the legend and the labels. Passed internally to par(family).

note

Logical: should a note be added to the bottom of the graphic to document the levels of the countour lines?

file.out

Location for writing the image to a file instead of plotting it on screen

...

Additional parameters optionally passed to boundary for the specification of the area of interpolation.

Details

The basic idea is to use some kind of interpolation to show areas of high-occurrence of a specific phonenomenon. Internally Kriging is used, and then only contour lines are shown of the interpolation. Multiple lines are suggested to indicate the probibabilistic interpretation of the lines.

Value

A plot is produces with the different phenomena in space surrounded by lines. When multiple options are possible at each point then pie charts are added.

Author(s)

Michael Cysouw <cysouw@mac.com>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# isogloss example
# choose one feature from hessen dataset (number 4)
data(hessen)
f4 <- hessen$data[,9:13]

# look for area for interpolation, changing density and grid parameters
# suitable parameters can be passed through to function lmap below
boundary(hessen$villages, density = 0.1, grid = 10)

# useful size of pies has to be determined by changing cex
plot(hessen$boundary, main = NULL)
lmap(hessen$villages, f4, draw = 3, cex = 0.8
  , density = 0.1, grid = 10, add = TRUE, cex.legend = 0.5)

# another isogloss example:
# "f" sounds in German dialects in the words "Kochl<c3><b6>ffel"
require(mapdata)
map("worldHires", "Germany", fill = TRUE, col = "grey90")

data(dialects)
lmap(dialects$villages, dialects$data[,21], levels = c(0.20, 0.22, 0.24)
    , add = TRUE, position = "topleft")
title(main = "f-sound in \'Kochl<c3><b6>ffel\'")

# semantic map example
# location of points via multidimensional scaling of complete data
data(haspelmath)
d <- dist(haspelmath)
p <- MASS::isoMDS(d)$points

# testing boundary parameters
boundary(p)
boundary(p, density = 0.004, box = 0.15, tightness = 8)

# labels to be plotted instead of points
text <- gsub("\\.", "\n", rownames(haspelmath))

# show a few languages
# using a quick dummy function to set all parameters
tmp <- function(columns) {
  lmap(p, haspelmath[,columns]
    , levels = 0.1, labels = text
    , density = 0.004, box = 0.15, tightness = 8
    , lambda = 0.1, note = FALSE)
}

## Not run: 
par(mfcol = c(2,3))
tmp(1:3)
tmp(4:6)
tmp(7:9)
tmp(10:12)
tmp(13:17)
tmp(18:22)
par(mfcol = c(1,1))
## End(Not run)

qlcVisualize documentation built on May 29, 2017, 9:35 p.m.