REditorSupport / vscode-R

R Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=REditorSupport.r
MIT License
1.08k stars 128 forks source link

Draw plots as SVG #1397

Open Tal500 opened 1 year ago

Tal500 commented 1 year ago

Currently the plot drawing is done only by drawing as PNG. It will be nice if the user could choose to draw the plots as SVG. Pro: It is faster in communication time and with scalable resolution.

qianchd commented 1 year ago

Please consider the httpgd viewer option. Or one may find it is useful to edit settings in .vscode-R/settings.json

Tal500 commented 1 year ago

Please consider the httpgd viewer option. Or one may find it is useful to edit settings in .vscode-R/settings.json

This option is a possibility, but it's not comfortable in my environment to open up a server, especially trough a remote SSH access. The changes needed from this code are very easy. The crucial one is to modify this line: https://github.com/REditorSupport/vscode-R/blob/9c7f4a217b8cfddd87d9f93489bae09b0923bc8b/R/session/vsc.R#L429 To something like:

 do.call(if(is_svg) svg else png, c(list(filename = plot_file), dev_args)) 

And the side ones are: https://github.com/REditorSupport/vscode-R/blob/9c7f4a217b8cfddd87d9f93489bae09b0923bc8b/R/session/vsc.R#L393 to

 plot_file <- file.path(dir_session, paste0("plot.", if(is_svg) "svg" else "png"))

, and add an option for the user "is_svg" somehow.

This just drops the amount of traffic for detailed graphs significantly.

github-actions[bot] commented 2 months ago

This issue is stale because it has been open for 365 days with no activity.