Description
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?