我正在用python绘制一个情节。代码如下。当只有几百个数据点时,代码执行良好,返回速度相当快;但是当有 200k 个数据点时,它需要几个小时。我需要缩短时间。但是怎么做?谢谢。
import numpy as np;
import matplotlib.pyplot as plt;
oneD = [];
#read in lines and append to oneD
oneD.append(float(aVariable));
oneD = (np.array(oneD));
oneD = oneD[ind];
x = np.arange(len(oneD));
#following line takes long time to execute
#print timestamp
plt.bar(x, oneD, width, edgecolor='orange', color='orange', alpha=0.7);
#print timestamp