Learn R Programming

eeptools (version 0.9.1)

theme_dpi_mapPNG: an alternate ggplot2 theme developed for PNG or JPG maps

Description

This is a custom ggplot2 theme developed for the Wisconsin Department of Public Instruction for making PNG or JPG maps

Usage

theme_dpi_mapPNG(base_size = 18, base_family = "")

Arguments

base_size
numeric, specify the font size, default is 18
base_family
character, specify the font family, this value is optional

Value

A theme object which is a list of attributes applied to a ggplot2 object.

Source

For more information see https://github.com/hadley/ggplot2/wiki/Themes

Details

All values are optional

See Also

his uses unit from the grid package extensively. See also theme_bw from the ggplot2 package.

Examples

Run this code
# Data
crimes <- data.frame(state = tolower(rownames(USArrests)), USArrests)
require(reshape) # for melt
crimesm <- melt(crimes, id = 1)
# No DPI theme
states_map <- map_data("state")
ggplot(crimes, aes(map_id = state)) + geom_map(aes(fill = Murder), map = states_map) + 
    expand_limits(x = states_map$long, y = states_map$lat)+ labs(title="USA Crime")
# Draw map
last_plot() + coord_map()
# DPI theme
ggplot(crimesm, aes(map_id = state)) + geom_map(aes(fill = value), map = states_map) + 
    expand_limits(x = states_map$long, y = states_map$lat) + 
    facet_wrap( ~ variable) + theme_dpi_mapPNG()

Run the code above in your browser using DataLab