Save ggplot2 plot as an Image Object
ggplot_to_image.Rd
This function saves a ggplot2 plot as a magick image object, using the desired width and height in inches and dpi resolution.
Arguments
- plot_object
ggplot2 plot that needs to be saved as image.
- image_width
Width of the image in inches. Default is 10.
- image_height
Height of the image in inches. Default is 10.
- image_resolution
Resolution of the image in dpi. Default is 300.
Examples
if (FALSE) {
library(ggplot2)
p <- ggplot(mpg, aes(displ, hwy, colour = class)) + geom_point()
img <- ggsave_to_image(p)
}