Learn R Programming

ggview


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.

Copy Link

Version

Install

install.packages('ggview')

Monthly Downloads

502

Version

0.2.2

License

GPL-2 | file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Iaroslav Domin

Last Published

July 5th, 2025

Functions in ggview (0.2.2)

canvas

Add a canvas specification to a ggplot object
save_ggplot

Save a ggplot