Description Usage Arguments Details Value Author(s) Examples
Plots a figure to the graphics device and saves it to file if requested.
1 2 3 4 5 6 7 8 9 10 |
p |
a |
show_plot |
whether the plot should be printed to the graphics device. Defualt is TRUE. |
save_to_file |
whether the plot should be saved to the disk. Default is TRUE. |
project_dir |
the root directory of the current project to which all plots are saved. Default is NULL meaning that the plots will be saved to the working directory. |
plots_dir |
a subdirectory in |
filename |
a name for the file to be saved. If NULL and |
dirname |
a name for the subdirectory in |
device |
a device to use. See ggsave for details. Default is "png" |
This function is basically a wrapper for ggsave that takes care of creating the directories to store plots in using the given arguments.
Invisibly returns the plot p
.
Avishay Spitzer
1 2 3 4 5 6 7 8 9 10 11 12 | # Generate some data
y <- rnorm(1000)
# Create an ordered scatter plot of the data
p <- scandal_scatter_plot(x = NULL, y = y, plot_ordered = TRUE, order_by_axis = "y")
# Will print p to the graphics device and save it to the file "scatter.png" in the current working directory
scandal_plot(p, show_plot = TRUE, save_to_file = TRUE, project_dir = ".", filename = "scatter.png", dirname = ".", plots_dir = ".")
# In this case p will be saved into a "plots" directory which will be created in the current working directory
# without printing p to the graphics device
scandal_plot(p, show_plot = FALSE, save_to_file = TRUE, project_dir = ".", filename = "scatter.png", dirname = ".", plots_dir = "plots")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.