selkamand / ggsaves

Wrapper for ggsave that automatically saves BOTH PDF + 300DPI PNG

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ggsaves

R-CMD-check CRAN status

ggsaves saves a ggplot as a PDF, 300dpi PNG, and SVG all at once. This is an exceptionally simple convenience package that wraps ggplot2::ggsave().

It can also save ggiraph objects in HTML, SVG, and PDF formats with ggisaves

Installation

Install the development version of ggsaves from GitHub with:

# install.packages("devtools")
devtools::install_github("selkamand/ggsaves")

Quick Start

Saving a ggplot

library(ggplot2)
library(ggsaves)

gg_plot <- mtcars |> 
  ggplot(aes(mpg, cyl)) + 
  geom_point() 

ggsaves(gg_plot, prefix = "myplot",  outfolder = ".")

Saving a ggiraph plot

library(ggiraph)
gg_plot <- iris |> 
  ggplot(aes(Sepal.Length, Sepal.Width)) + 
  geom_point_interactive(aes(data_id  = Species, tooltip = Species))

 interactive_gg_plot <- girafe(ggobj = gg_plot)
 
 ggisaves(interactive_gg_plot, prefix = "my_interactive_plot", outfolder = ".")

About

Wrapper for ggsave that automatically saves BOTH PDF + 300DPI PNG

License:Other


Languages

Language:R 100.0%