remoter
remoter copied to clipboard
[Question] Graphics with remoter
Remoter is great for running code in a remote server. How can I create graphs and have them display in my local R Studio window?
i.e
counts <- table(mtcars$gear)
barplot(counts, main="Car Distribution", xlab="Number of Gears")
https://github.com/snoweye/user2016.demo may help.
Thank you for the link @snoweye
Do you know if R needs some specific capabilities enabled for the graph to show up without using the s2c
function?
The following still doesn't show the graphs on my R Studio window:
g1 <- ggplot(data=iris, aes(x=Sepal.Length, y=Sepal.Width, color=Species)) + geom_point(aes(shape = Species))
g1
But executing the following 2 lines does display the graph in the plots panel:
s2c(g1)
evalc(g1)
Again, thank you for your help!
We had a bunch of changes over the summer, and it's quite likely that I messed something up during a merge. I'll take a look as soon as I can.
Thank you @wrathematics
I'm using the remoter package from CRAN. Should I be using the github version instead?
- This version may still work well without
s2c
andevalc
, but no guarantee. - The question is why you want to
s2c
that objectg1
rather than the data creatingg1
back to local?
Thank you. I can try with that version.
Well, I was just trying different things to see if the image would show up. Ideally, I would like to write code that still runs if I'm not connected to a remoter::server Ideally
without any s2c
or evalc
I get a plot in my RStudio session, but it is distorted.
Could I ask if it's possible to fix the distortion?
Here's what it looks like on my screen:
(Notice that the text is stretched horizontally)
library(ggplot2)
qplot(1:4, 1:4)
- Short answer long: resize the plotting window because it is plotted as a bitmap not regular plot/graph displayed at client window or save the plot in a pdf file and use
s2c
to bring the file back. - Median answer median: adjust the windows size before plotting the image and disallow resizing after that.
- Long answer short: a callback function is not easy.