amitash
amitash

Reputation: 31

Plotting lines with gnuplot python

I have a list:

x = [1,2,3,4]

Now using gnuplot, I have plotted the points as (0,1), (1,2), ...

Here is the syntax I used:

g = Gnuplot.Gnuplot()
g.plot(x)

Now I have my required set of points but I want to join these points by a line. How do I do that?

Upvotes: 2

Views: 3913

Answers (1)

chl
chl

Reputation: 29347

Does the following work for you?

>>> import Gnuplot
>>> x = [1,2,3,4]
>>> gp = Gnuplot.Gnuplot()
>>> gp.title('My title')
>>> gp('set style data linespoints')
>>> gp.plot(x)

You can pass whatever options you want in the 5th command.

Upvotes: 3

Related Questions