python - gnuplot.py - 绘制时间与距离图 - 多条线

标签 python gnuplot

如何在 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)

这是我的输出: enter image description here

关于python - gnuplot.py - 绘制时间与距离图 - 多条线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27210302/

相关文章:

Python,正则表达式 : Is it possible to have 2 ending anchors?

python - 以编程方式更改肤色

python - 使用 Python 获取上周的日期

python - 扭曲:检查延迟是否已经被调用

gnuplot - gnuplot 直方图上的平滑线

gnuplot - 使用统计数据计算标准差

for-loop - gnuplot:for和columnheader命令

python - 为什么我无法在Python中抓取这个链接?

gnuplot - 是否可以通过 GNUPLOT 中的数字更改图中的点?

gnuplot - 如何在 gnuplot 中绘制树形图