Closed wdiao-zju closed 3 years ago
grid.draw
does not call .External.graphics(...)
which is hacked to trigger plot replay as png file to show in vscode.
I recommend that you use httpgd as the graphics device. As long as you have installed the package, you might want to put the following code in your ~/.Rprofile
:
options(vsc.plot = FALSE)
options(device = function(...) {
httpgd::hgd(silent = TRUE)
.vsc.browser(httpgd::hgd_url(), viewer = "Beside")
})
or you could try the latest development build and enable the plot viewer implemented in #620 based on httpgd:
options(vsc.use_httpgd = TRUE)
or you could try the latest development build and enable the plot viewer implemented in #620 based on httpgd:
options(vsc.use_httpgd = TRUE)
Thanks. I use latest development build](https://github.com/Ikuyadeu/vscode-R/releases/tag/latest. It works very well. The new plot viewer is amazing.
grid::grid.draw() does not work and base::plot() or ggplot() works in vscode-R watcher, however, grid::grid.draw() works in Rstudio. Examples of R codes as follows:
------------ R code start --------------------------- library(grid) grid.newpage() vp <- viewport(x = 0.5, y = 0.5, width = 0.5, height = 0.25, angle=45) pushViewport(vp) a <- rectGrob() grid.draw(a) ------------ R code end---------------------------
Environment: