Learn R Programming

eeptools (version 0.3.1)

theme_dpi_map: a ggplot2 theme developed for PDF or SVG maps

Description

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

Usage

theme_dpi_map(base_size = 14, base_family = "")

Arguments

base_size
specify the font size as a numeric value, this value is optional
base_family
specify the font family, this value is optional

Value

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

Details

All values are optional

References

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

See Also

This uses unit from the gridExtra 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_map()

Run the code above in your browser using DataLab