You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've discovered if I run a script line by line (e.g. Ctrl+Enter) in VSCode that has a plot call ggplot(data = complete_old, mapping = aes(x = weight, y = hindfoot_length, color = plot_type)), VSCode will automatically open the plot viewer; but if I source the entire script (e.g. Ctrl+Shift+S or clicking on the '>' in the top right corner), the plot viewer does not open.
If I wrap it in a print(ggplot(...)) and source the entire script, then VSCode will open the plot viewer.
I know that I can manually open the interactive window by inputting .vsc.attach() into the R console, but it still shows nothing if the script was sourced rather than ran line-by-line.
I've also tried this with httpgd and including the VSCode setting "r.plot.useHttpgd": true,, but this also doesn't work either when sourcing the entire script.
I am using the R extension for VSCode as well.
I would have thought that I didn't need to wrap it in a print(...) when sourcing the entire script?
The text was updated successfully, but these errors were encountered:
I know nothing about VSCode and how it interacts with graphics devices. Is this a ggplot2 specific problem, or does the same happen with base graphics? If this doesn't happen with base graphics, does it happen with grid/lattice graphics?
I think this issue will get a better audience at a different venue like stackoverflow or the posit community. I'm not aware of any other ggplot2 developer that uses VSCode. In contrast, I expect R users with ggplot2 experience that work in VSCode to be a much larger group. They might be able to provide better help than we can.
I've discovered if I run a script line by line (e.g. Ctrl+Enter) in VSCode that has a plot call
ggplot(data = complete_old, mapping = aes(x = weight, y = hindfoot_length, color = plot_type))
, VSCode will automatically open the plot viewer; but if I source the entire script (e.g. Ctrl+Shift+S or clicking on the '>' in the top right corner), the plot viewer does not open.If I wrap it in a
print(ggplot(...))
and source the entire script, then VSCode will open the plot viewer.I know that I can manually open the interactive window by inputting .vsc.attach() into the R console, but it still shows nothing if the script was sourced rather than ran line-by-line.
I've also tried this with httpgd and including the VSCode setting
"r.plot.useHttpgd": true,
, but this also doesn't work either when sourcing the entire script.I am using the R extension for VSCode as well.
I would have thought that I didn't need to wrap it in a
print(...)
when sourcing the entire script?The text was updated successfully, but these errors were encountered: