View source: R/ggartprint_example_map.R
ggartprint_example_map | R Documentation |
This example uses Open Street Map data to make a print of a map. It's based on a tutorial by Joshua McCrain.
ggartprint_example_map(
title,
subtitle,
coordinates = NULL,
colors = NULL,
text_rel_sizes = NULL
)
title |
The larger top line of text above the plot, if coordinates not specified also used to find the map location |
subtitle |
The smaller lower line of text above the plot, if coordinates not specified also used to find the map location |
coordinates |
(optional) exactly the location for the map. Needs to be a matrix with row names |
colors |
(optional) a named vector of colors to use for the plot. Defaults to
|
text_rel_sizes |
(optional) the relative sizes of the text to use. Defaults to |
The location of the map is either derived from the header string ("title, subtitle"), or can be specified precisely using the coordinates option.
The sizing was tested using an 11"x14" print with portrait orientation–other sizes and shapes will require
adjusting the text size using the text_rel_sizes
parameter.
It's recommended you pass ggartprint the parameter background="#FEFDF7"
to avoid having white margins around the print.
a ggplot2 plot to pass to ggartprint
library(ggirl)
contact_email <- "fakeemailforreal@gmail.com"
delivery_address <- address(name = "Fake Personname", address_line_1 = "250 North Ave",
city = "Boston", state = "MA",
postal_code = "22222", country = "US")
plot <- ggartprint_example_map("Seattle", "Washington")
background <- "#FEFDF7" # use the background option only when your background isn't white
ggartprint(plot, size = "11x14", orientation = "portrait",
contact_email = contact_email,
address = delivery_address,
background = background)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.