Vim-R-plugin icon indicating copy to clipboard operation
Vim-R-plugin copied to clipboard

have many plot displayed at the same time

Open casertap opened this issue 9 years ago • 6 comments

Is it possible to have many plot displayed at the same time? Like an option to always have a new window that open every time you do plot(...)

Thanks, awesome plugin.

casertap avatar Aug 20 '15 15:08 casertap

I found that I can use:

dev.new()

between 2 plot to open a new window.

casertap avatar Aug 20 '15 15:08 casertap

Many different commands might result in plots, and I don't know how to detect that there will be a plot. If I knew, I could make the nvimcom package automatically call dev.new() before each plot. Perhaps, what you want is a new option for X11.options(), but, then, you should make your request to the R Core Team. I think RStudio does what you want, but it has its own plotting device, and I am not going to write one.

jalvesaq avatar Aug 20 '15 23:08 jalvesaq

Of course. I am good with the dev.new() technique for now. I have been using Vim-R-plugin for few days and it is awesome. Thanks.

casertap avatar Aug 21 '15 06:08 casertap

Perhaps another option is a kind of yank ring for plots, with mappings for recordPlot and replayPlot to save and replay plots, storing them in a list object within the vimcom namespace.

nacnudus avatar Nov 26 '15 10:11 nacnudus

I could implement support for recordPlot() and replayPlot(). It would be easy to add a key binding to manually call recordPlot(), but I still don't know how to detect when a plot was finished and, thus, when recordPlot() should be automatically called.

jalvesaq avatar Nov 26 '15 11:11 jalvesaq

I think the best solution would be to have native X11, Quartz and Windows support for this feature. The user would put in the ~/.Rprofile:

grDevices::X11.options(record = TRUE)

Then, when the focus was on the graphical device window, the Left and Right arrow keys could be used to replay the plots.

jalvesaq avatar Nov 26 '15 12:11 jalvesaq