我在用熊猫数据框绘制字典时遇到了一个问题。在下面的代码中,我运行一个for循环来迭代字典的索引。q、 fs和fsd是相同长度的字典。问题是,我保存的文件有20MB大,对于一个有两个子插槽的图形来说,这显然太大了。问题是我如何绘制列表字典中的元素并生成占用较少空间的数字?你知道吗
fig=plt.figure()
for kk in q:
plt.subplot(211)
plt.xlim(min(testset['T(K)']), max(testset['T(K)']))
plt.plot(q[kk]['T(K)'], fsd[kk](q[kk]['T(K)']), color='green', linewidth=2, label='derivative')
plt.xlabel('T(K)')
plt.title('Data derivative')
plt.subplot(212)
plt.xlim(min(testset['T(K)']), max(testset['T(K)']))
plt.plot(q[kk]['T(K)'], fs[kk](q[kk]['T(K)']), color='blue', linewidth=2, label='fit')
plt.scatter(q[kk]['T(K)'],(q[kk]['Vol(V)']), s=3, color='red') #'r--', lw=2, label='raw data')
plt.xlabel('T(K)')
plt.ylabel('Vol(V)')
plt.title('Fit+scattered data')
fig.subplots_adjust(hspace=0.1)
plt.show()
目前没有回答
相关问题 更多 >
编程相关推荐