Learn R Programming

qlcVisualize (version 0.4)

heeringa: Heeringa-style colours

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. Highly useful to visualize pairwise similarities between geographic regions.

Usage

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

Value

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

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 means '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.

Author

Michael Cysouw <cysouw@mac.com>

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.

References

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

Examples

Run this code
data(hessen)
tess <- weightedMap(hessen$villages, window = hessen$boundary, crs = 2397)
d <- dist(hessen$data, method = "canberra")

# different mappings of the colors
c1 <- heeringa(d)
plot(tess$weightedVoronoi, col = c1, border = NA)

c2 <- heeringa(d, power = 1, mapping = c(3, -2, 1))
plot(tess$weightedVoronoi, col = c2, border = NA)

Run the code above in your browser using DataLab