Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plot in External browser trigger error of “useMethod” #1512

Open
liuhuoz opened this issue Apr 16, 2024 · 3 comments
Open

plot in External browser trigger error of “useMethod” #1512

liuhuoz opened this issue Apr 16, 2024 · 3 comments
Labels

Comments

@liuhuoz
Copy link

liuhuoz commented Apr 16, 2024

Describe the bug
When open an external browser (in case, Google Chrome), and draw a ggplot2 plot, the plot would not draw or in a wired way that elements are disrupted. Further, the terminal show message like:

Error in UseMethod("depth") :
  no applicable method for 'depth' applied to an object of class "NULL"
Error in grid.Call.graphics(C_upviewport, as.integer(n)) : 
  cannot pop the top-level viewport ('grid' and 'graphics' output mixed?)

However, after closing the browser, everything come back to normal.

Besides, directly using Radian without vscode and httpgd::hgd() function to open an external browser would not response such error.

To Reproduce
here is my test code

data <- data.frame(
  x=rnorm(10), 
  y=rnorm(10)
)
data
p <- 
data %>% 
  ggplot(aes(x=x,y=y))+
  geom_point(size=10)
p

Steps to reproduce the behavior:

  1. draw a plot in vscode windows
  2. Click on 'Open in External Browser'
  3. draw another plot
  4. See error

Can you fix this issue by yourself? (We appreciate the help)

No

(If applicable) Please attach setting.json

{
    "r.rterm.option": [],
    "r.bracketedPaste": true,
    "files.associations": {
        "*.rmd": "markdown"
    },
    "r.rterm.windows": "D:\\miniconda3\\Scripts\\radian.exe",
    "r.rpath.windows": "D:\\R\\R-4.3.3\\bin\\R.exe",
    "r.plot.defaults.fullWindowMode": true,
    "r.workspaceViewer.showObjectSize": true,
    "r.lsp.use_stdio": true,
    "r.session.levelOfObjectDetail": "Detailed",
    "r.lsp.multiServer": false,
    "r.removeLeadingComments": true,
    "r.plot.useHttpgd": true,
    "r.session.useWebServer": true,
    "r.source.echo": true
}

Expected behavior
the plot should be draw both in vscode window and browser

Screenshots
If applicable, add screenshots to help explain your problem.
You can show the keyboard contents by pressing F1 and Developer: toggle screencast mode

Environment (please complete the following information):

  • OS: Windows 11
  • VSCode Version: 1.85.2
  • VScode insider:1.89.0 (both stable and insider have this error)
  • R Version: 4.3.3
  • vscode-R version: 2.8.2
@liuhuoz liuhuoz added the bug label Apr 16, 2024
@liuhuoz
Copy link
Author

liuhuoz commented May 22, 2024

The problem still exist after updating vscode-R to 2.8.5

@py9mrg
Copy link

py9mrg commented May 30, 2024

I have the same problem. Seems to have started since httpgd was "revived" and the plotting split out into unigd.

@liuhuoz
Copy link
Author

liuhuoz commented May 30, 2024

I have the same problem. Seems to have started since httpgd was "revived" and the plotting split out into unigd.

Recently I draw the chord picture with the package "circlize" which is not a ggplot-based drawing system. When plotting in both vscode and bowser, it doesnt trigger any problem. However, when I draw other pic with ggplot2 in the same drawing dev, the error happened.
It seems like a quite complex problem, and may relate to many packages, vscode-R and vscode itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants