'ggplot2' Picture Previewer

Preview what a 'ggplot2' plot would look like if you save it to a file. Attach picture dimensions as a canvas() element and get an instant preview. These dimensions will then be used when you save the plot.


ggview


CRAN status R-CMD-check

Choose the right picture size for a ggplot without leaving your IDE.

  1. Set picture dimensions with the canvas() element.

  1. Save the plot with save_ggplot().
p <- 
  ggplot(mtcars, aes(wt, mpg)) +
  geom_point() +
  ggtitle("My Plot") +
  canvas(800, 1000, units = "px")

save_ggplot(p, "my_plot.png")

Installation

install.packages("ggview")

# development version
remotes::install_github("idmn/ggview")

VS Code

The package relies on the rstudioapi::viewer() function to display plot previews. By default it does not work in VS Code, but installing the R extension fixes it. It tricks the rstudioapi package into believing it is running in RStudio, and everything works.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("ggview")

0.2.2 by Iaroslav Domin, a year ago


https://github.com/idmn/ggview


Report a bug at https://github.com/idmn/ggview/issues


Browse source code at https://github.com/cran/ggview


Authors: Iaroslav Domin [aut, cre, cph]


Documentation:   PDF Manual  


GPL-2 | file LICENSE license


Imports ggplot2, rstudioapi

Suggests testthat, png


See at CRAN