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, 02 Nov 2012 13:47:41 +0100gnuplot() - how to use...https://ask.sagemath.org/question/9462/gnuplot-how-to-use/I have installed the gnuplot spkg using sage -i gnuplot and sage indicates that the package successfully installed.
I would like to use this as an interface, and I'm wondering how to call up the function gnuplot()
If I do
sage: g = gnuplot()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/pat/pythonStuff/<ipython console> in <module>()
TypeError: __call__() takes exactly 2 arguments (1 given)
Question: What do I need to supply? I have no self object as the gnuplot() constructor (if that's what it is) is supposed to produce a self bound to the variable g.Wed, 24 Oct 2012 12:12:26 +0200https://ask.sagemath.org/question/9462/gnuplot-how-to-use/Answer by kcrisman for <p>I have installed the gnuplot spkg using sage -i gnuplot and sage indicates that the package successfully installed.</p>
<p>I would like to use this as an interface, and I'm wondering how to call up the function gnuplot()</p>
<p>If I do</p>
<h2>sage: g = gnuplot() </h2>
<p>TypeError Traceback (most recent call last)</p>
<p>/home/pat/pythonStuff/<ipython console=""> in <module>()</p>
<p>TypeError: __call__() takes exactly 2 arguments (1 given)</p>
<p>Question: What do I need to supply? I have no self object as the gnuplot() constructor (if that's what it is) is supposed to produce a self bound to the variable g.</p>
https://ask.sagemath.org/question/9462/gnuplot-how-to-use/?answer=14183#post-id-14183See [the source](http://hg.sagemath.org/sage-main/file/d06cf4b2215d/sage/interfaces/gnuplot.py#l41). I haven't got a clue what "line" is supposed to be, but presumably it's some sort of graphics objects. So you'd need
L = line([(1,2),(2,3),(4,2)])
gnuplot(L)
But even that raises an exception for me, even after I install both gnuplot and gnuplotpy spkgs.
gnuplot> set terminal aqua
^
line 0: unknown or ambiguous terminal type; type just 'set terminal' for a list
<snip>
1032 if isinstance(other, Graphics3d):
1033 return self.plot3d() + other
-> 1034 raise TypeError, "other (=%s) must be a Graphics objects"%other
1035 g = Graphics()
1036 g._objects = self._objects + other._objects
TypeError: other (=
) must be a Graphics objects
So I think one really has to actually send the gnuplot string command. This did something, though not useful to me:
sage: gnuplot('set term svg')
sage: gnuplot('plot sin(x)/x')
Even
sage: gnuplot('set terminal')
which is supposed to give a list, stops with the first set of things, because Sage interprets that as the end of the output.
As you can see in that file, this is very old code that hasn't been used much. For instance, the [plot method](http://hg.sagemath.org/sage-main/file/d06cf4b2215d/sage/interfaces/gnuplot.py#l51) doesn't have any useful documentation. You probably have to already know gnuplot syntax to use it, *and* how to get the terminal to do its thing.Wed, 24 Oct 2012 14:08:18 +0200https://ask.sagemath.org/question/9462/gnuplot-how-to-use/?answer=14183#post-id-14183Comment by kcrisman for <p>See <a href="http://hg.sagemath.org/sage-main/file/d06cf4b2215d/sage/interfaces/gnuplot.py#l41">the source</a>. I haven't got a clue what "line" is supposed to be, but presumably it's some sort of graphics objects. So you'd need</p>
<pre><code>L = line([(1,2),(2,3),(4,2)])
gnuplot(L)
</code></pre>
<p>But even that raises an exception for me, even after I install both gnuplot and gnuplotpy spkgs.</p>
<pre><code>gnuplot> set terminal aqua
^
line 0: unknown or ambiguous terminal type; type just 'set terminal' for a list
<snip>
1032 if isinstance(other, Graphics3d):
1033 return self.plot3d() + other
-> 1034 raise TypeError, "other (=%s) must be a Graphics objects"%other
1035 g = Graphics()
1036 g._objects = self._objects + other._objects
TypeError: other (=
) must be a Graphics objects
</code></pre>
<p>So I think one really has to actually send the gnuplot string command. This did something, though not useful to me:</p>
<pre><code>sage: gnuplot('set term svg')
sage: gnuplot('plot sin(x)/x')
</code></pre>
<p>Even </p>
<pre><code>sage: gnuplot('set terminal')
</code></pre>
<p>which is supposed to give a list, stops with the first set of things, because Sage interprets that as the end of the output.</p>
<p>As you can see in that file, this is very old code that hasn't been used much. For instance, the <a href="http://hg.sagemath.org/sage-main/file/d06cf4b2215d/sage/interfaces/gnuplot.py#l51">plot method</a> doesn't have any useful documentation. You probably have to already know gnuplot syntax to use it, <em>and</em> how to get the terminal to do its thing.</p>
https://ask.sagemath.org/question/9462/gnuplot-how-to-use/?comment=18761#post-id-18761Yes, that is true.Fri, 02 Nov 2012 13:47:41 +0100https://ask.sagemath.org/question/9462/gnuplot-how-to-use/?comment=18761#post-id-18761Comment by PatB for <p>See <a href="http://hg.sagemath.org/sage-main/file/d06cf4b2215d/sage/interfaces/gnuplot.py#l41">the source</a>. I haven't got a clue what "line" is supposed to be, but presumably it's some sort of graphics objects. So you'd need</p>
<pre><code>L = line([(1,2),(2,3),(4,2)])
gnuplot(L)
</code></pre>
<p>But even that raises an exception for me, even after I install both gnuplot and gnuplotpy spkgs.</p>
<pre><code>gnuplot> set terminal aqua
^
line 0: unknown or ambiguous terminal type; type just 'set terminal' for a list
<snip>
1032 if isinstance(other, Graphics3d):
1033 return self.plot3d() + other
-> 1034 raise TypeError, "other (=%s) must be a Graphics objects"%other
1035 g = Graphics()
1036 g._objects = self._objects + other._objects
TypeError: other (=
) must be a Graphics objects
</code></pre>
<p>So I think one really has to actually send the gnuplot string command. This did something, though not useful to me:</p>
<pre><code>sage: gnuplot('set term svg')
sage: gnuplot('plot sin(x)/x')
</code></pre>
<p>Even </p>
<pre><code>sage: gnuplot('set terminal')
</code></pre>
<p>which is supposed to give a list, stops with the first set of things, because Sage interprets that as the end of the output.</p>
<p>As you can see in that file, this is very old code that hasn't been used much. For instance, the <a href="http://hg.sagemath.org/sage-main/file/d06cf4b2215d/sage/interfaces/gnuplot.py#l51">plot method</a> doesn't have any useful documentation. You probably have to already know gnuplot syntax to use it, <em>and</em> how to get the terminal to do its thing.</p>
https://ask.sagemath.org/question/9462/gnuplot-how-to-use/?comment=14131#post-id-14131Thanks for your investigation. I have concluded that this interface has been developed as an unsupported experiment package, and hasn't been maintained. Best to look elsewhere for plotting alternatives.Fri, 02 Nov 2012 11:58:50 +0100https://ask.sagemath.org/question/9462/gnuplot-how-to-use/?comment=14131#post-id-14131