Muflix
Muflix

Reputation: 6798

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

Upvotes: 25

Views: 40471

Answers (2)

TheRimalaya
TheRimalaya

Reputation: 4592

Now it is possible.

Step 1:

a) Install httpgd from CRAN or github. From CRAN,

From CRAN:

install.packages("httpgd")

From GitHub:

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.

Upvotes: 18

Jamalan
Jamalan

Reputation: 580

It looks like its opening an external graphics window. Try putting

windows();plot(stuff)

This explicitly pushes the plot to an external window

Upvotes: 8

Related Questions