l_micromaps: Linked Micromaps in loon

Description Usage Arguments Value Examples

Description

Compares different statistics across geographical regions

Usage

1
2
3
4
5
l_micromaps(top = tktoplevel(), mm_inspector = TRUE, title = "Micromaps",
  map.label = "Map", lab.label = "Labels", spdf, grouping = NULL,
  n_groups = NULL, variables, num_optvars = NULL, spacing = c("equal",
  "max"), color = NULL, size = 6, linkingKey = NULL,
  linkingGroup = NULL, sync = c("pull", "push"), ...)

Arguments

top

Tk top level window. Defaults to a new window

mm_inspector

Whether to draw custom inspector for the display, which allows for variable selection, variable label update, font size adjustment, and setting grouping of points. Defaults to TRUE. Once created, the inspector can only be closed when the main display window is closed

title

Title for linked micromaps. Appears in the title bar of the toplevel window

map.label

Label for maps (rightmost) panel

lab.label

Label for labels (leftmost) panel

spdf

SpatialPolygonsDataFrame object to hold polygon coordinates and attributes. It should contain statistics used for comparing between regions

grouping

An optional character vector specifying how many points to have per row (from top to bottom of display)

n_groups

An optional integer specifying how many rows to have. If both grouping and n_groups are provided, grouping is applied

variables

List specifying variables to plot. Variable required: id.var and grouping.var. Optional variables: more variables to plot. id.var specifies the names of points. The grouping.var is used to decide the ordering of points on the map. All variables, with the exception of id.var, should be a list with name, and optional xlab and optional label arguments. For example, for a variable named 'ed' used for grouping, the variables argument would look like: variables = list(grouping.var = list(name = "ed", xlab = "Percent", label = "% with University Education"))

num_optvars

Number of possible optional variables for mm_inspector. Defaults to NULL, in which case it is determined based on how many variables are provided to variables

spacing

Spacing scheme for points - either 'equal' or 'max'. The 'equal' scheme spaces points out equally, while the 'max' scheme ensures the same amount of spacing between points as the row with the largest number of points

color

Color scheme. Defaults to NULL, in which case colors are generated using loon::loon_palette. Cannot be 'cornsilk' or 'magenta', which are reserved colors

size

Size of glyphs for scatterplots and label panel. Defaults to 6

linkingKey

Linking mechanism in loon. Points with the same linkingKey value are linked together. Defaults to NULL, in which case the linkingKey values are index values starting from 0

linkingGroup

Linking mechanism in loon. Displays with the same linkingGroup are linked together. Defaults to NULL, in which case the linkingGroup is "Micromaps"

sync

Can be either 'pull' or 'push', determines whether the initial synchronization should adapt to the linked states of other linked plots ("pull") or whether it should overwrite the states of the other linked plot with its own linked states ("push")

...

Other optional named arguments to modify states of scatterplots

Value

An object of classes loon_micromaps and loon, containing the Tk toplevel window, linkingGroup value, linkingKey values, and the handles for the loon plot objects corresponding to the labels panel, scatterplot panel(s) and map panel in list form

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 

data("USstates", package = "micromap")
data("edPov", package = "micromap")

USstates@data <- merge(USstates@data, edPov, by.x = 'ST', by.y = 'StateAb')

mm <- l_micromaps(lab.label = 'States',
                  spdf = USstates,
                  variables = list(id.var = 'ST_NAME',
                                   grouping.var = list(name = 'pov', xlab = 'Percent'),
                                   var2 = list(name = 'ed', xlab = 'Percent')),
                  spacing = 'max', sync = 'push',
                  itemLabel = as.character(USstates@data$ST_NAME),
                  showItemLabels = T)


## End(Not run)

x249wang/loon.micromaps documentation built on May 10, 2019, 8:30 a.m.