grattan_save_overleaf.RdA wrapper around grattan_save() that saves PDF charts directly to
your Overleaf project's atlas folder via Dropbox sync. On first use, you'll
be prompted to select which Overleaf project to use. This choice is stored
for the current R session, or can be set with set_overleaf_project().
grattan_save_overleaf(
filename,
object = ggplot2::last_plot(),
type = "normal",
...
)Filename for the chart, with or without .pdf extension
A ggplot object. Defaults to the last plot created.
Chart type - see ?grattan_save for options. Defaults to "normal".
Additional arguments passed to grattan_save(), such as
height, dpi, force_labs, etc.
The function saves only the PDF version of your chart to the
atlas subfolder of your chosen Overleaf project. No PPTX or data
files are created. Charts are saved directly to the Overleaf directory
without creating subdirectories.
Since the Overleaf project setting only persists for the current R session,
we recommend calling set_overleaf_project() in your script (or a
setup script, if used). This improves reproducibility of your code.
if (FALSE) { # \dontrun{
library(ggplot2)
# Set the Overleaf project at the start of your script
set_overleaf_project("Orange") # Searches for matching project
# Create and save charts
p <- ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point()
grattan_save_overleaf("my_chart.pdf", p)
# Save with 'wholecolumn' chart type
grattan_save_overleaf("tall_chart.pdf", p, type = 'wholecolumn')
# Change to a different project
set_overleaf_project("transport-report")
grattan_save_overleaf("another_chart.pdf", p)
} # }