heeringa: Heeringa-style colours

Description Usage Arguments Details Value Author(s) References Examples

View source: R/heeringa.R

Description

Proposed in Heeringa (2004) to colour a (dis)similarity by decomposing it into three dimensions (using cmdscale here) and then mapping these dimensions to RGB to make colours. Hihgly useful to visualize pairwise similarities between geographic regions.

Usage

1
heeringa(dist, power = 0.5, mapping = c(1, 2, 3), method = "eigs", center = NULL)

Arguments

dist

dist object specifying distances between points.

power

Factor used to influence the results of the multidimensional scaling. Values closer to one will lead to clearer separated colours, while higher values will lead to more gradual colours.

mapping

Optional vector to change the mapping of the dimensions to the colours. Should be of length 3, specifying to which color each of the three dimensions is mapped. A 1 means 'red', a 2 meand 'green' and a 3 means 'blue'. Adding a minus reverses the mapping.

method

Method used to determine the colour dimensions. Either mds (nicer colourbalance) or eigs (much faster).

center

Optionally, specify an index of one of the points to be put in the center of the coloring scheme, i.e. this point will become grey and all other points will be colored relative to this point.

Details

This proposal goes back to Heeringa (2004). The idea is to visualize distances by mapping the first three dimensions of a multidimensional scaling to the the red-green-blue scales. The mapping vector can be used to change the mapping to the colours.

Value

A vector of colours of the same length as the size of the dist object.

Author(s)

Michael Cysouw <cysouw@mac.com>

References

Heeringa, Wilbert. "Measuring Dialect Pronunciation Differences Using Levenshtein Distance." Ph.D. Thesis, Rijksuniversiteit Groningen, 2004.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(hessen)
tessalation <- voronoi(hessen$villages, hessen$boundary)
d <- dist(hessen$data, method = "canberra")

# different mappings of the colors
c1 <- heeringa(d)
vmap(tessalation, col = c1, border = NA)

c2 <- heeringa(d, power = 1, mapping = c(3, -2, 1))
vmap(tessalation, col = c2, border = NA)

cysouw/qlcVisualize documentation built on Dec. 26, 2021, 6:14 p.m.