Learn R Programming

rfigshare (version 0.3-0)

plot_to_filename: Convienence function to save a ggplot2 plot, and return its filename.

Description

Convienence function to save a ggplot2 plot, and return its filename.

Usage

plot_to_filename(plotobj, filename, path = ".")

Arguments

plotobj
ggplot2 plot object (should add support for base plots too)
filename
Filename, don't include the file type extension.
path
Path where you want to save the file.

Value

A file name, to use in fs_upload

See Also

fs_upload

Examples

Run this code
## Not run: 
# # include in your fs_upload call
# library(ggplot2)
# p <- qplot(mpg, wt, data=mtcars)
# plott <- fs_create(title="my title", description="some description", type="figure")
# fs_add_categories(plott, "Ecology")
# fs_upload(plott, plot_to_filename(p, "myfilename", "~"))
# ## End(Not run)

Run the code above in your browser using DataLab