Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can use VS Code and R to create plots by following these steps:

  1. Install the R extension in VS Code.

  2. Create a new R script in VS Code.

  3. Write your R code to create a plot. For example, you can use the built-in datasets in R to create a scatter plot:

data(mtcars)
plot(mtcars$wt, mtcars$mpg)
  1. Run your R code by selecting all or part of your code and using the Run Code command or the keyboard shortcut.

  2. The plot should appear in the Plots pane in VS Code. You can click on the plot to open it in a new window and save it as an image file.