Ask Your Question
1

gnuplot() - how to use...

asked 12 years ago

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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 12 years ago

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

Preview: (hide)
link

Comments

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 ( 12 years ago )

Yes, that is true.

kcrisman gravatar imagekcrisman ( 12 years ago )

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

Stats

Asked: 12 years ago

Seen: 1,541 times

Last updated: Nov 02 '12