Python gnuplot.py-绘制时间与距离图-多行
如何在gnuplot.py中绘制x与y图?例如,这就是我想要的: 我要多行 我的代码:Python gnuplot.py-绘制时间与距离图-多行,python,gnuplot,Python,Gnuplot,如何在gnuplot.py中绘制x与y图?例如,这就是我想要的: 我要多行 我的代码: import Gnuplot g = Gnuplot.Gnuplot(debug=1) g.title('A simple example') # (optional) g('set data style linespoints') # give gnuplot an arbitrary command g.title('Data can be computed by python or gnuplot')
import Gnuplot
g = Gnuplot.Gnuplot(debug=1)
g.title('A simple example') # (optional)
g('set data style linespoints') # give gnuplot an arbitrary command
g.title('Data can be computed by python or gnuplot')
g.xlabel('x')
g.ylabel('y')
one = ([0, 1], [2, 3], [5, 5])
g.plot(one)
raw_input()
输出:
只有一行。如果我试图策划另一个,什么也不会发生 只需在代码中添加其他数据集即可
two=([6,4], [7,5], [8,3])
three=([0,2], [2,1], [5,6], [6,5], [7,7], [8,4])
最后,用图形绘制出三个数据集
g.plot(one, two, three)
以下是我的输出:
在gnuplot的较新版本(>4.4?)中,如果您使用:
g('set data style linespoints')
与原始帖子一样,您将得到一个错误:
第0行:无法识别的选项。请参阅“帮助集”
取而代之的是使用:
g('set style data lines')