[R-gui] Plots not generating or running in web-browser

Philippe Grosjean phgrosjean at sciviews.org
Fri Jun 10 06:15:03 CEST 2005


Neha Sinha wrote:
> Hi,
> 
> I am a beginner in R (using it for about 2-3 days now) and I have a couple 
> of problems I am encountering.
> 
> I am working on a windows machine and using putty to ssh into the "box" 
> where R is installed (I think Unix is running on the box I ssh into). The 
> problem I am facing is that when I try to plot using the plot function in R 
> (after invoking x11), nothing shows up - no window pops up with the plot. 
> But when I use the startx command in cygwin and ssh, the graph pops up.

Well, the X11 graph device needs a graphic system that you start with 
startx... isn't it logical?

> My project is to graph a couple of points and display it on the web, so that 
> other users in my group can view it. The code I am using just to generate a 
> graph of random numbers is as follows:
> 
> #! /bin/sh /usr/bin/setR
> 
> cat("Content-type: text/html", '\n\n')
> 
> library(grDevices)
> library(graphics)
> 
> cat("<html><head><title> 1st test page </title></head>",'\n')
> cat("<body>",'\n')
> 
> r <- sample(1:20, 5)
> cat("Random plot: ", r,'<br/>\n')
> 
> x11("192.9.200.232:0 <http://192.9.200.232:0>.0")
> png(file="/tmp/R-web/random.png")
> plot( r, type="b" )
> dev.off()
> cat("<img src='http://splustest/plots/random.png'/>",'\n')
> 
> cat("</body>",'\n')
> q(save="no")
> 
> Now when I open a webbrowser on my machine and load this html/.R code, the 
> graph is not generated (as I checked in the random.png file) nor does it 
> show up. Clearly, this is happening because some x11 settings on my machine 
> is missing. I am stuck at a point where I do not know how to fix this 
> problem. I would be thankful for some helpful advice.
> 
> Regards,

I work on a Windows system. So, I cannot check this. I though that png() 
was independent from X11, i.e., it generates graphs on files directly?

If you don't have better answer on this list, you should better post it 
to R-help. This is a general question, not related with GUI aspects.
Best,

Philippe Grosjean

> Neha Sinha
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-SIG-GUI mailing list
> R-SIG-GUI at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-gui
> 
>



More information about the R-SIG-GUI mailing list