Description Usage Arguments Examples
View source: R/ggplot2_utils.R
A thin wrapper around ggplot2::ggsave()
that takes a plot as the first
argument and filename
as the second (the reverse of ggplot2::ggsave()
),
but that doesn't save the plot when called interactively. Works best inside R
Markdown documents, allowing you to view the figure when running the code
chunk interactively but ensure that a specific copy of the figure is saved to
a specific directory during the markdown rendering.
1 2 3 4 5 6 7 8 9 10 11 |
plot |
Plot to save, defaults to last plot displayed. |
filename |
File name to create on disk. |
width |
Plot size in |
height |
Plot size in |
device |
Device to use. Can either be a device function
(e.g. |
include |
Mimics the knitr |
... |
Additional arguments passed on to |
force_save |
If |
base_dir |
Save figures into a specified directory |
1 2 3 4 5 6 7 8 9 10 | ## Not run:
iris %>%
{
ggplot(.) +
aes(Sepal.Length, Sepal.Width, color = Species) +
geom_point()
} %>%
ggsave_and_print("iris_plot.png", width = 10, height = 6)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.