Numpy本身不支持绘图。通常,您将
matplotlib用于绘制numpy数组。
如果您只想“查看文件”,我认为最简单的方法是使用
plotfile。
import matplotlib.pyplot as pltplt.plotfile('data.dat', delimiter=' ', cols=(0, 1), names=('col1', 'col2'), marker='o')plt.show()您可以像
gnuplot在ipython中一样使用此功能:
$ ipython --pylab......In [1]: plt.plotfile('data.dat', delimiter=' ', cols=(0, 1), ... names=('col1', 'col2'), marker='o')或将其放在shell脚本中,并将参数传递给它,以直接从您的shell中使用它



