Ask Your Question

gnuplot() - how to use...

asked 2012-10-24 12:12:26 +0200

PatB gravatar image

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-10-24 14:08:18 +0200

kcrisman gravatar image

See the source. 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)])

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
   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')


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 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.

edit flag offensive delete link more


Thanks 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.

PatB gravatar imagePatB ( 2012-11-02 11:58:50 +0200 )edit

Yes, that is true.

kcrisman gravatar imagekcrisman ( 2012-11-02 13:47:41 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2012-10-24 12:12:26 +0200

Seen: 1,202 times

Last updated: Nov 02 '12