You can save your plot as a png file and then load it back into youyr file you have several option for saving your plot. you could use ggplot2s' ggsave() function or you could use the save_plot() from the cowplot package. save_plot() is said to give you more flexibility when it comes file adjusting hence my pick. You can explore both.
refer to https://rdrr.io/cran/cowplot/man/save_plot.html to read more about save_plot.
tmp = data.frame(first = c('a','b','c','d','e','f','g','h','i','j','k','l','m','n'), second = c(2,3,4,5,2,3,4,5,6,3,4,4,6, 7)) plot_tmp = ggplot(tmp, aes(first, second)) + geom_bar(stat = 'identity') dev.new() if("png" %in% installed.packages()){ library(png) }else{ install.packages("png") library(png) } save_plot("~/plot_tmp.png", plot_tmp, base_height = NULL, base_aspect_ratio = 1.618, base_width = 6)
Use the following steps to load files into your shiny using by using the
#read plot library(OpenImageR) img<-OpenImageR::readImage("~/plot_tmp.png") imageShow(img)
Hopefully this helps. To read more about OpenImageR and how you can use it in shiny please go to https://cran.r-project.org/web/packages/OpenImageR/vignettes/The_OpenImageR_package.html
have fun!!!
loadworks;loadstores objects in the current environment;p(the return object ofload) is a character vector of the names of the objects (see?load). Soload("plots/trans_arima.Rdata"); p;will plot objectpthat is stored in"plots/trans_arima.Rdata"(provided there is one).load("plots/trans_arima.Rdata"); new_name <- p;