Generate, plot, and compare many tile maps.
many_maps( data, labels, square = TRUE, flat_topped = FALSE, prop = c(0, 0.05), interpolate = c(0.5, 1), smoothness = c(0, 5), shift = list(c(0, 0), c(0.5, 0), c(0, 0.5)), weights = c(1, 1, 1, 1), plot = TRUE, size = 2 )
data | An object of class |
---|---|
labels | A character vector with the labels of the regions. Labels must
be in the same order as regions given for |
square | logical. If |
flat_topped | logical. If |
prop | A numeric vector of proportions used in specifying the standard
deviation of the Gaussian noise added to original region centroids. The
standard deviation of the Gaussian noise is calculated as the mean
distance between a region centroid and its neighboring regions' centroids
multiplied by the value provided for the |
interpolate | A numeric vector of values between 0 and 1 controlling the linear interpolation between the noisy region centroids and fully-transformed region centroids. If 0, noisy region centroids are used. If 1, fully-transformed centroids are used. A different set of interpolated centroids is created for each given value. |
smoothness | numeric vector. Controls the bandwidth of the Gaussian
kernel used for smoothing the transformed boundary polygon. The bandwidth
is calculated as the mean distance between adjacent boundary points
multiplied by the value provided for the |
shift | A list of numeric vectors of length two specifying the number of grid steps to shift the candidate tile map in the x and y directions before counting the number of tile centroids that lie within the transformed boundary. A different final tile map is created for each given value. |
weights | A numeric vector of length 4 specifying the weights used for calculating the total cost. The first, second, third, and fourth weights are applied to the location, adjacency, angle, and roughness costs, respectively. |
plot | logical. If |
size | numeric. Controls size of labels in plot. |
Returns a data.frame
in which each row corresponds to one map
and the columns contain the generated maps, the parameters used for
creating the maps, and the costs associated with each map. The
data.frame
is ordered by the total cost.
Generates many candidate tile maps using an algorithm proposed in
"Generating Tile Maps" (McNeill and Hale 2017). The regions of the
map must be contiguous. Coordinates cannot be in terms of latitude and
longitude. Instead the coordinate reference system must be an appropriate
planar projection. The number of maps generated is equal to the product of
the lengths of the prop
, interpolate
, smoothness
, and
shift
arguments.
McNeill, Graham, and Scott A Hale. 2017. “Generating Tile Maps.” In Computer Graphics Forum, 36:435–45. 3. Wiley Online Library.
library(sf) northeast <- governors[c(6,7,17,18,19,27,28,30,36,37,43),] ne_maps <- many_maps(northeast$geometry, northeast$abbreviation, prop = 0, interpolate = 1, smoothness = c(0,20), shift = list(c(0,0), c(0,0.5)))