question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Plot viewer not working with radian.

See original GitHub issue

The issue When I use radian as my default R Plots stubbornly use X11, rather than showing up in VSCode.

To Reproduce Steps to reproduce the behavior:

  1. Install languageserver package, then, vscode-R.
  2. Install radian (with pip install -U radian).
  3. Set to use radian as R to use"r.rterm.mac": "/usr/local/bin/radian"
  4. Run “R: Create R terminal” to attach an R (radian) session.
  5. Make a plot, e.g. plot(c(1, 2, 3), c(1, 3, 2))
  6. The plot opens in X11 viewer, not inside VSCode.

If I repeat these steps from 3 on, but without setting radian as the rterm, then it works as expected (I get the PNG plot in the VSCode pane). How can I make this happen with radian too?

all my r setting.json settings:

"r.alwaysUseActiveTerminal": true,
"r.bracketedPaste": true,
"r.rterm.mac": "/usr/local/bin/radian",
"r.sessionWatcher": true,

my ~/.Rprofile is empty.

I have tried setting options(vsc.plot = TRUE) or “Two” in ~/.Rprofile, and also tried using httpgd (which is installed), by setting vsc.plot to FALSE, and adding "r.plot.useHttpgd": true, to the settings json. In both cases it seems to work fine with vanilla R (I can use httpgd with the latter setting), but with radian, I just get the X11 window for plots.

Expected behavior I expect the plot to appear as a PNG (or SVG with httpgd) in VSCode.

Environment

  • OS: macOS 12.1 (x86)
  • VSCode Version: Version: 1.64.0
  • R Version: 4.1.0
  • vscode-R version: 2.3.6

Thanks for the really great extension! I just want to get the plots working (ideally with httpgd and radian).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
renkun-kencommented, Feb 6, 2022

If you start R from vscode terminal, then you need to follow https://github.com/REditorSupport/vscode-R/wiki/R-Session-watcher#advanced-usage-for-self-managed-r-sessions and put the following in your ~/.Rprofile:

source(file.path(Sys.getenv(
   if (.Platform$OS.type == "windows") "USERPROFILE" else "HOME"
 ), ".vscode-R", "init.R"))
0reactions
postylemcommented, Oct 9, 2022

I have moved to a new computer, with the following setup, and I do not have this problem anymore. The plots are now rendered in vscode, not X11, without me having to do anything.

  • OS: macOS 12.4 (Apple silicon)
  • VSCode Version: Version: 1.72.0-insider
  • R Version: 4.1.2
  • REditorSupport version: 2.5.3
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to show R graph from visual studio code - Stack Overflow
From vscode setting, select R > Plot: Use httpgd to use for R plot. They have done a amazing job with R extension....
Read more >
Display angle in degree instead of radians in plot
Solved: Hello, In my plot, i am showing the angle in radians(X-axis). how can i display it in degrees w/o changing the plot?...
Read more >
Data > Visualize
Plot -type. Select the plot type you want. For example, with the diamonds data loaded select Distribution and all (X) variables (use CTRL-a...
Read more >
R in Visual Studio Code
Besides the workspace viewer, there is also a data viewer, a plot viewer, and a widget viewer. Read Interactive viewers for more details....
Read more >
Using R in VS Code - Schiff Consulting
I've only used VS Code for a short time so am not an expert, ... Then at the far right is the terminal...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found