如何在 gnuplot.py 中绘制 x 与 y 图表?例如,这就是我想要的:http://www.mathwarehouse.com//graphs/distance-vs-time/images/distance-vs-time-graph-picture4.jpg
我想要多行。
我的代码:
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()
输出:http://gyazo.com/ba9fb6d6762c864758a7b494d44d384f
只有一行。如果我尝试策划另一个阴谋,什么也不会发生。
最佳答案
只需在代码中添加其他数据集
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)
这是我的输出:
关于python - gnuplot.py - 绘制时间与距离图 - 多条线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27210302/