urbn_save: Save ggplot2 plots in standard Urban Institute sizes

Description Usage Arguments Examples

View source: R/urbn_save.R

Description

This is a function to save standardized images for Urban Institute publications. For more functionality like custom widths and heights, use ggsave() directly.

Usage

1
2
3
4
5
6
7
urbn_save(
  filename,
  plot = ggplot2::last_plot(),
  size = "medium",
  dpi = 300,
  height = NULL
)

Arguments

filename

File name to create on disk.

plot

Plot to save, defaults to last plot displayed.

size

Size of plot. Must be one of "small" (3.25 x 2 inches), "medium" (6.5 x 4 inches), or "large" (9 x 6.5 inches).

dpi

Plot resolution. Also accepts a string input: "retina" (320), "print" (300), or "screen" (72). Applies only to raster output types.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
library(tidyverse)
library(urbnthemes)

set_urbn_defaults(style = "print")

cars %>%
  ggplot(aes(speed, dist)) +
  geom_point()

urbn_save("test.png")

## End(Not run)

UrbanInstitute/urbnthemes documentation built on Jan. 26, 2022, 8:34 p.m.