plot_size: Get plot size

Description Usage Arguments Value Examples

View source: R/plot.R

Description

This is most useful for setting image dimensions in Rmd code chunks. It will display text to copy for the code chunk only when running interactively.

Usage

1
plot_size(plot = ggplot2::last_plot(), dpi = webmorph_options("dpi"))

Arguments

plot

Plot to measure, defaults to last plot displayed.

dpi

Plot resolution for determining size in inches (usually 300 for print and 72 for screen)

Value

invisibly returns a list of plot width and height in pixels

Examples

1
2
3
demo_stim() %>% plot()
plot_size() %>% str() # fig.width = 2.35, fig.height = 1.19
plot_size(dpi = 72) %>% str() # fig.width = 9.81, fig.height = 4.97

facelab/webmorph documentation built on April 11, 2021, 6:34 a.m.