# initial example
data("USstates")
head(USstates@data)
statePolys <- create_map_table(USstates, 'ST')
head(statePolys)
data("edPov")
# basic figure 1
lmplot(stat.data = edPov,
map.data = statePolys,
panel.types = c('labels', 'dot', 'dot','map'),
panel.data = list('state','pov','ed', NA),
ord.by = 'pov',
grouping = 5, median.row = TRUE,
map.link = c('StateAb','ID'))
if (FALSE) {
# publication figure 1a
lmplot(stat.data = edPov, map.data = statePolys ,
panel.types = c('labels', 'dot', 'dot','map'),
panel.data = list('state','pov','ed', NA),
ord.by = 'pov',
grouping = 5,
median.row = TRUE,
map.link = c('StateAb','ID'),
plot.height = 9,
colors = c('red','orange','green','blue','purple'),
map.color2 = 'lightgray',
panel.att = list(
list(1, header = 'States', panel.width = .8, align = 'left',
text.size = .9),
list(2, header = 'Percent Living Below \n Poverty Level',
graph.bgcolor = 'lightgray', point.size = 1.5,
xaxis.ticks = list(10,15,20), xaxis.labels = list(10,15,20),
xaxis.title = 'Percent'),
list(3, header = 'Percent Adults With\n4+ Years of College',
graph.bgcolor = 'lightgray', point.size = 1.5,
xaxis.ticks = list(0,20,30,40), xaxis.labels = list(0,20,30,40),
xaxis.title = 'Percent'),
list(4, header = 'Light Gray Means\nHighlighted Above',
inactive.border.color = gray(.7), inactive.border.size = 2,
panel.width = .8)))
edPov$points <- 0
# publication figure 1b
lmplot (stat.data = edPov, map.data = statePolys,
panel.types = c('dot', 'labels', 'dot', 'dot', 'map'),
panel.data = list('points', 'state', 'pov', 'ed', NA),
map.link = c('StateAb','ID'),
ord.by = 'pov',
grouping = 5,
median.row = TRUE,
plot.height = 9,
colors = c('red','orange','green','blue','purple'),
map.color2 = 'lightgray',
panel.att = list(list(1, panel.width = .15, point.type = 20,
graph.border.color = 'white',
xaxis.text.display = FALSE, xaxis.line.display = FALSE,
graph.grid.major = FALSE),
list(2, header = 'States', panel.width = .8,
align = 'left', text.size = .9),
list(3, header = 'Percent Living Below\nPoverty Level',
graph.bgcolor = 'lightgray', point.size = 1.5,
xaxis.ticks = list(10,15,20),
xaxis.labels = list(10,15,20),
xaxis.title = 'Percent'),
list(4, header = 'Percent Adults With\n4+ Years of College',
graph.bgcolor = 'lightgray', point.size = 1.5,
xaxis.ticks = list(20,30,40),
xaxis.labels = list(20,30,40),
xaxis.title = 'Percent'),
list(5, header = 'Light Gray Means\nHighlighted Above',
inactive.border.color = gray(.7), inactive.border.size = 2,
panel.width = .8)))
# publication figure 1c
myPlot <- lmplot(stat.data = edPov, map.data = statePolys,
panel.types = c('map', 'dot', 'labels', 'dot', 'dot'),
panel.data = list(NA, 'points', 'state', 'pov', 'ed'),
map.link = c('StateAb','ID'),
ord.by = 'pov',
grouping = 5,
median.row = TRUE,
plot.height = 9,
colors = c('red','orange','green','blue','purple'),
map.color2 = 'lightgray',
panel.att = list(list(2, panel.width = .15, point.type = 20,
graph.border.color = 'white',
xaxis.text.display = FALSE, xaxis.line.display = FALSE,
graph.grid.major = FALSE),
list(3, header = 'States', panel.width = .8,
align = 'left', text.size = .9),
list(4, header = 'Percent Living Below\nPoverty Level',
graph.bgcolor = 'lightgray', point.size = 1.5,
xaxis.ticks = list(10,15,20), xaxis.labels = list(10,15,20),
xaxis.title = 'Percent'),
list(5, header = 'Percent Adults With\n4+ Years of College',
graph.bgcolor = 'lightgray', point.size = 1.5,
xaxis.ticks = list(20,30,40),
xaxis.labels = list(20,30,40),
xaxis.title = 'Percent'),
list(1, header = 'Light Gray Means\nHighlighted Above',
inactive.border.color = gray(.7), inactive.border.size = 2,
panel.width = .8)))
print(myPlot, name = 'myExhibit.tiff', res = 300)
}
Run the code above in your browser using DataLab