ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 25 May 2012 11:13:50 +0200using 'R' in sage: can not plot. errors of X11 and PNGhttps://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/Hi!
We are going to use SAGE this semester in a course which has a piece of statistics. For this part we planned to compile Sage worksheets
with the option 'R'. But we have the following errors. If we write the instruction:
**x<-c(12,2,4)**
**y<-x**
**plot(x,y)**
the instruction works in a mac which has a local sage (packages are on the hard disk). However, the pupils will use the sage server of our university (v4.6), wich gives the error message:
**Error in png() : X11 is not available**
The same error is obtained with a local installation on windows 7 (v4.7.2, with VM virtual box).
Besides, if we try at sage server on sagenb.org (v4.7.2), we obtain a different error:
**Error in X11(paste("png::", filename, sep = ""), width, height,
pointsize, :
unable to start device PNG
In addition: Warning message:
In png() : no png support in this version of R**
Please, does anybody know how to fix it?
Thank you. Thu, 26 Jan 2012 07:15:47 +0100https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/Answer by kcrisman for <p>Hi!
We are going to use SAGE this semester in a course which has a piece of statistics. For this part we planned to compile Sage worksheets
with the option 'R'. But we have the following errors. If we write the instruction: </p>
<p><strong>x<-c(12,2,4)</strong></p>
<p><strong>y<-x</strong></p>
<p><strong>plot(x,y)</strong></p>
<p>the instruction works in a mac which has a local sage (packages are on the hard disk). However, the pupils will use the sage server of our university (v4.6), wich gives the error message:</p>
<p><strong>Error in png() : X11 is not available</strong></p>
<p>The same error is obtained with a local installation on windows 7 (v4.7.2, with VM virtual box).</p>
<p>Besides, if we try at sage server on <a href="http://sagenb.org">sagenb.org</a> (v4.7.2), we obtain a different error:</p>
<p><strong>Error in X11(paste("png::", filename, sep = ""), width, height,
pointsize, :
unable to start device PNG
In addition: Warning message:
In png() : no png support in this version of R</strong></p>
<p>Please, does anybody know how to fix it?</p>
<p>Thank you. </p>
https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?answer=13195#post-id-13195If you look at the list of "related questions" on the right of this question, you'll see several things which should answer this for you. The most useful one should be [Compiling R with PNG support](http://ask.sagemath.org/question/192/compiling-r-with-png-support) (see in particular Jason Grout's answer).
Basically, you need to have certain other libraries installed and somehow made known to Sage for this to work on a Linux server. The 4.8 VirtualBox solution should now have this enabled (right, Volker?). Unfortunately, sagenb.org is currently missing this support as well. Maybe this should get fixed... see [this sage-devel thread](http://groups.google.com/group/sage-devel/browse_thread/thread/11a8eedde829cf0d).
Edit: This now works on sagenb.org! Thanks to William for installing them.Thu, 26 Jan 2012 08:09:07 +0100https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?answer=13195#post-id-13195Answer by mathematicboy for <p>Hi!
We are going to use SAGE this semester in a course which has a piece of statistics. For this part we planned to compile Sage worksheets
with the option 'R'. But we have the following errors. If we write the instruction: </p>
<p><strong>x<-c(12,2,4)</strong></p>
<p><strong>y<-x</strong></p>
<p><strong>plot(x,y)</strong></p>
<p>the instruction works in a mac which has a local sage (packages are on the hard disk). However, the pupils will use the sage server of our university (v4.6), wich gives the error message:</p>
<p><strong>Error in png() : X11 is not available</strong></p>
<p>The same error is obtained with a local installation on windows 7 (v4.7.2, with VM virtual box).</p>
<p>Besides, if we try at sage server on <a href="http://sagenb.org">sagenb.org</a> (v4.7.2), we obtain a different error:</p>
<p><strong>Error in X11(paste("png::", filename, sep = ""), width, height,
pointsize, :
unable to start device PNG
In addition: Warning message:
In png() : no png support in this version of R</strong></p>
<p>Please, does anybody know how to fix it?</p>
<p>Thank you. </p>
https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?answer=13197#post-id-13197Thank you for your quick and accurate answers. I'm sorry I did not know the questions on the right part of the screen. I tried to do a search and only found some threads and finally got lost. I'm not an expert.
I will try installing the 4.8 ova file but I have to wait, because the current version in the servers I have checked is 4.7.2.
But mainly I'm interested in fixing the sage server of my university. So I will show your answers to the administrator of that server to see what is more suitable.
I will tell you the end of the story.
Thank you so much!!! Thu, 26 Jan 2012 14:42:44 +0100https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?answer=13197#post-id-13197Comment by kcrisman for <p>Thank you for your quick and accurate answers. I'm sorry I did not know the questions on the right part of the screen. I tried to do a search and only found some threads and finally got lost. I'm not an expert.</p>
<p>I will try installing the 4.8 ova file but I have to wait, because the current version in the servers I have checked is 4.7.2.</p>
<p>But mainly I'm interested in fixing the sage server of my university. So I will show your answers to the administrator of that server to see what is more suitable.</p>
<p>I will tell you the end of the story.
Thank you so much!!! </p>
https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?comment=20416#post-id-20416Great, update us!Thu, 26 Jan 2012 16:34:14 +0100https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?comment=20416#post-id-20416Comment by kcrisman for <p>Thank you for your quick and accurate answers. I'm sorry I did not know the questions on the right part of the screen. I tried to do a search and only found some threads and finally got lost. I'm not an expert.</p>
<p>I will try installing the 4.8 ova file but I have to wait, because the current version in the servers I have checked is 4.7.2.</p>
<p>But mainly I'm interested in fixing the sage server of my university. So I will show your answers to the administrator of that server to see what is more suitable.</p>
<p>I will tell you the end of the story.
Thank you so much!!! </p>
https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?comment=20415#post-id-20415As the questions on the side, I just wanted to point out that this, somewhat surprisingly, often turns out to be quite helpful. Of course, they wouldn't show up until you've asked the question, so you could hardly have known.Thu, 26 Jan 2012 16:34:49 +0100https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?comment=20415#post-id-20415Answer by shahuwang for <p>Hi!
We are going to use SAGE this semester in a course which has a piece of statistics. For this part we planned to compile Sage worksheets
with the option 'R'. But we have the following errors. If we write the instruction: </p>
<p><strong>x<-c(12,2,4)</strong></p>
<p><strong>y<-x</strong></p>
<p><strong>plot(x,y)</strong></p>
<p>the instruction works in a mac which has a local sage (packages are on the hard disk). However, the pupils will use the sage server of our university (v4.6), wich gives the error message:</p>
<p><strong>Error in png() : X11 is not available</strong></p>
<p>The same error is obtained with a local installation on windows 7 (v4.7.2, with VM virtual box).</p>
<p>Besides, if we try at sage server on <a href="http://sagenb.org">sagenb.org</a> (v4.7.2), we obtain a different error:</p>
<p><strong>Error in X11(paste("png::", filename, sep = ""), width, height,
pointsize, :
unable to start device PNG
In addition: Warning message:
In png() : no png support in this version of R</strong></p>
<p>Please, does anybody know how to fix it?</p>
<p>Thank you. </p>
https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?answer=13612#post-id-13612Two setup to do so:
command:sage -f r
it will rebuilt the R in sage to enable plotting support.
and then:
png()
x<-c(12,2,4)
y<-x
plot(x,y)
dev.off()Fri, 25 May 2012 11:13:50 +0200https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?answer=13612#post-id-13612Answer by Volker Braun for <p>Hi!
We are going to use SAGE this semester in a course which has a piece of statistics. For this part we planned to compile Sage worksheets
with the option 'R'. But we have the following errors. If we write the instruction: </p>
<p><strong>x<-c(12,2,4)</strong></p>
<p><strong>y<-x</strong></p>
<p><strong>plot(x,y)</strong></p>
<p>the instruction works in a mac which has a local sage (packages are on the hard disk). However, the pupils will use the sage server of our university (v4.6), wich gives the error message:</p>
<p><strong>Error in png() : X11 is not available</strong></p>
<p>The same error is obtained with a local installation on windows 7 (v4.7.2, with VM virtual box).</p>
<p>Besides, if we try at sage server on <a href="http://sagenb.org">sagenb.org</a> (v4.7.2), we obtain a different error:</p>
<p><strong>Error in X11(paste("png::", filename, sep = ""), width, height,
pointsize, :
unable to start device PNG
In addition: Warning message:
In png() : no png support in this version of R</strong></p>
<p>Please, does anybody know how to fix it?</p>
<p>Thank you. </p>
https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?answer=11799#post-id-11799Plotting with r does indeed work in the virtual machine now:
![image description](/upfiles/13275964824750648.png)Thu, 26 Jan 2012 11:48:24 +0100https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?answer=11799#post-id-11799Comment by kcrisman for <p>Plotting with r does indeed work in the virtual machine now:</p>
<p><img alt="image description" src="/upfiles/13275964824750648.png"/></p>
https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?comment=20418#post-id-20418That's what I thought, though you could have just commented that they should download the 4.8 ova file ;-) Interesting that one can post screenshots, I hadn't thought of that before, but it would be very natural in this context.Thu, 26 Jan 2012 11:56:40 +0100https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?comment=20418#post-id-20418Comment by Volker Braun for <p>Plotting with r does indeed work in the virtual machine now:</p>
<p><img alt="image description" src="/upfiles/13275964824750648.png"/></p>
https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?comment=20417#post-id-20417Yes I mainly posted the screenshot because I wanted to try out this feature ;-)Thu, 26 Jan 2012 14:54:10 +0100https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?comment=20417#post-id-20417Answer by mathematicboy for <p>Hi!
We are going to use SAGE this semester in a course which has a piece of statistics. For this part we planned to compile Sage worksheets
with the option 'R'. But we have the following errors. If we write the instruction: </p>
<p><strong>x<-c(12,2,4)</strong></p>
<p><strong>y<-x</strong></p>
<p><strong>plot(x,y)</strong></p>
<p>the instruction works in a mac which has a local sage (packages are on the hard disk). However, the pupils will use the sage server of our university (v4.6), wich gives the error message:</p>
<p><strong>Error in png() : X11 is not available</strong></p>
<p>The same error is obtained with a local installation on windows 7 (v4.7.2, with VM virtual box).</p>
<p>Besides, if we try at sage server on <a href="http://sagenb.org">sagenb.org</a> (v4.7.2), we obtain a different error:</p>
<p><strong>Error in X11(paste("png::", filename, sep = ""), width, height,
pointsize, :
unable to start device PNG
In addition: Warning message:
In png() : no png support in this version of R</strong></p>
<p>Please, does anybody know how to fix it?</p>
<p>Thank you. </p>
https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?answer=13223#post-id-13223Hi!
I've been trying to apply your advices and this is the result:
First I tried the just downloaded 4.8 ova file and the sagenb.org server. In both cases the result is the same, that is:
The instructions:
x=r([1,2,3,4,5])
y=r([1,2,3,2,1])
r.plot(x,y)
work fine.
However, when I write:
x<-c(1,2,3,4,5)
y<-c(1,2,3,2,1)
plot(x,y)
and try to compile with 'R', I don't obtain any error message, but the graphic is not shown. That is, I obtain an empty output.
Finally I tried with my ubuntu 10.4. and sage 4.8. I installed packages libpango1.0-dev and libcairo-dev with xorg-dev previously installed. I got an error that says 'Unable to start r' So I guess this is a matter of my lack of competence in linux and not a general problem.Wed, 01 Feb 2012 08:24:27 +0100https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?answer=13223#post-id-13223Comment by kcrisman for <p>Hi!</p>
<p>I've been trying to apply your advices and this is the result:</p>
<p>First I tried the just downloaded 4.8 ova file and the <a href="http://sagenb.org">sagenb.org</a> server. In both cases the result is the same, that is:</p>
<p>The instructions:</p>
<pre><code>x=r([1,2,3,4,5])
y=r([1,2,3,2,1])
r.plot(x,y)
</code></pre>
<p>work fine.</p>
<p>However, when I write:</p>
<pre><code>x<-c(1,2,3,4,5)
y<-c(1,2,3,2,1)
plot(x,y)
</code></pre>
<p>and try to compile with 'R', I don't obtain any error message, but the graphic is not shown. That is, I obtain an empty output.</p>
<p>Finally I tried with my ubuntu 10.4. and sage 4.8. I installed packages libpango1.0-dev and libcairo-dev with xorg-dev previously installed. I got an error that says 'Unable to start r' So I guess this is a matter of my lack of competence in linux and not a general problem.</p>
https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?comment=20353#post-id-20353Sweet! Fri, 03 Feb 2012 10:43:10 +0100https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?comment=20353#post-id-20353Comment by mathematicboy for <p>Hi!</p>
<p>I've been trying to apply your advices and this is the result:</p>
<p>First I tried the just downloaded 4.8 ova file and the <a href="http://sagenb.org">sagenb.org</a> server. In both cases the result is the same, that is:</p>
<p>The instructions:</p>
<pre><code>x=r([1,2,3,4,5])
y=r([1,2,3,2,1])
r.plot(x,y)
</code></pre>
<p>work fine.</p>
<p>However, when I write:</p>
<pre><code>x<-c(1,2,3,4,5)
y<-c(1,2,3,2,1)
plot(x,y)
</code></pre>
<p>and try to compile with 'R', I don't obtain any error message, but the graphic is not shown. That is, I obtain an empty output.</p>
<p>Finally I tried with my ubuntu 10.4. and sage 4.8. I installed packages libpango1.0-dev and libcairo-dev with xorg-dev previously installed. I got an error that says 'Unable to start r' So I guess this is a matter of my lack of competence in linux and not a general problem.</p>
https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?comment=20354#post-id-20354Thank you! It works now.Fri, 03 Feb 2012 09:26:11 +0100https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?comment=20354#post-id-20354Comment by kcrisman for <p>Hi!</p>
<p>I've been trying to apply your advices and this is the result:</p>
<p>First I tried the just downloaded 4.8 ova file and the <a href="http://sagenb.org">sagenb.org</a> server. In both cases the result is the same, that is:</p>
<p>The instructions:</p>
<pre><code>x=r([1,2,3,4,5])
y=r([1,2,3,2,1])
r.plot(x,y)
</code></pre>
<p>work fine.</p>
<p>However, when I write:</p>
<pre><code>x<-c(1,2,3,4,5)
y<-c(1,2,3,2,1)
plot(x,y)
</code></pre>
<p>and try to compile with 'R', I don't obtain any error message, but the graphic is not shown. That is, I obtain an empty output.</p>
<p>Finally I tried with my ubuntu 10.4. and sage 4.8. I installed packages libpango1.0-dev and libcairo-dev with xorg-dev previously installed. I got an error that says 'Unable to start r' So I guess this is a matter of my lack of competence in linux and not a general problem.</p>
https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?comment=20352#post-id-20352(I have to point out that it is unfortunate that I had to use four space characters just in order to do that last comment.)Fri, 03 Feb 2012 10:43:51 +0100https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?comment=20352#post-id-20352Comment by Volker Braun for <p>Hi!</p>
<p>I've been trying to apply your advices and this is the result:</p>
<p>First I tried the just downloaded 4.8 ova file and the <a href="http://sagenb.org">sagenb.org</a> server. In both cases the result is the same, that is:</p>
<p>The instructions:</p>
<pre><code>x=r([1,2,3,4,5])
y=r([1,2,3,2,1])
r.plot(x,y)
</code></pre>
<p>work fine.</p>
<p>However, when I write:</p>
<pre><code>x<-c(1,2,3,4,5)
y<-c(1,2,3,2,1)
plot(x,y)
</code></pre>
<p>and try to compile with 'R', I don't obtain any error message, but the graphic is not shown. That is, I obtain an empty output.</p>
<p>Finally I tried with my ubuntu 10.4. and sage 4.8. I installed packages libpango1.0-dev and libcairo-dev with xorg-dev previously installed. I got an error that says 'Unable to start r' So I guess this is a matter of my lack of competence in linux and not a general problem.</p>
https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?comment=20368#post-id-20368In R, the plot command will write an Rplots.pdf to the current directory and not print anything on screen. Yes, using R thorugh sage is a bit more user-friendly. Arguably this is what Sage is about, making it easier to use scientific software.Wed, 01 Feb 2012 15:40:48 +0100https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?comment=20368#post-id-20368Comment by kcrisman for <p>Hi!</p>
<p>I've been trying to apply your advices and this is the result:</p>
<p>First I tried the just downloaded 4.8 ova file and the <a href="http://sagenb.org">sagenb.org</a> server. In both cases the result is the same, that is:</p>
<p>The instructions:</p>
<pre><code>x=r([1,2,3,4,5])
y=r([1,2,3,2,1])
r.plot(x,y)
</code></pre>
<p>work fine.</p>
<p>However, when I write:</p>
<pre><code>x<-c(1,2,3,4,5)
y<-c(1,2,3,2,1)
plot(x,y)
</code></pre>
<p>and try to compile with 'R', I don't obtain any error message, but the graphic is not shown. That is, I obtain an empty output.</p>
<p>Finally I tried with my ubuntu 10.4. and sage 4.8. I installed packages libpango1.0-dev and libcairo-dev with xorg-dev previously installed. I got an error that says 'Unable to start r' So I guess this is a matter of my lack of competence in linux and not a general problem.</p>
https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?comment=20366#post-id-20366You'd probably need to open and close a graphics device. See http://user2010.org/slides/Crisman.pdf, especially the part about "This example is due to Andrzej Giniewicz."Wed, 01 Feb 2012 21:18:06 +0100https://ask.sagemath.org/question/8670/using-r-in-sage-can-not-plot-errors-of-x11-and-png/?comment=20366#post-id-20366