rvisual-studio-code

How to show R graph from visual studio code


I installed extension for R language https://marketplace.visualstudio.com/items?itemName=Ikuyadeu.r

When i run my R code in visual studio code with (ctrl + enter) i get empty window instead of graph image.

enter image description here

but in visual studio 2017 it works

enter image description here


Solution

  • Now it is possible.

    Step 1:

    a) Install httpgd from Github (was formerly available on CRAN, but has been removed in April 2025)

    devtools::install_github("nx10/httpgd")
    

    b) Install languageserver:

    install.packages("languageserver")
    

    Step 2:

    Install R extension for vscode

    Step 3:

    From vscode setting, select R > Plot: Use httpgd to use for R plot.

    They have done a amazing job with R extension. We can view data.frame and list in a separate data viewer in vscode.