【发布时间】:2020-06-25 00:45:18
【问题描述】:
我正在尝试使用以下两个数组创建条形图 - xbinmids 作为 x 坐标,xbinned_ms 作为条形的高度。
xbinned_ms: [6.28e-16, 0, 0, 0, 0, 0, 6.28e-16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6.28e-16]
xbinmids: [1.9869553456140592e-26, 5.960866036842178e-26, 9.934776728070296e-26, 1.3908687419298414e-25, 1.7882598110526532e-25, 2.185650880175465e-25, 2.583041949298277e-25, 2.9804330184210885e-25, 3.377824087543901e-25, 3.7752151566667126e-25, 4.172606225789524e-25, 4.569997294912336e-25, 4.967388364035148e-25, 5.36477943315796e-25, 5.762170502280771e-25, 6.159561571403584e-25, 6.556952640526395e-25, 6.954343709649207e-25, 7.351734778772019e-25, 7.749125847894831e-25, 8.146516917017643e-25, 8.543907986140454e-25, 8.941299055263266e-25, 9.338690124386079e-25, 9.73608119350889e-25, 1.0133472262631701e-24, 1.0530863331754513e-24, 1.0928254400877326e-24, 1.1325645470000137e-24, 1.1723036539122949e-24, 1.2120427608245762e-24, 1.2517818677368573e-24, 1.2915209746491384e-24, 1.3312600815614196e-24, 1.3709991884737009e-24, 1.410738295385982e-24, 1.4504774022982631e-24, 1.4902165092105445e-24, 1.5299556161228256e-24, 1.5696947230351067e-24, 1.6094338299473879e-24, 1.6491729368596692e-24, 1.6889120437719503e-24, 1.7286511506842314e-24, 1.7683902575965126e-24, 1.8081293645087937e-24, 1.8478684714210752e-24, 1.8876075783333563e-24, 1.9273466852456375e-24, 1.9670857921579186e-24, 2.0068248990701997e-24]
当我使用以下方法绘制这些数组时:
xlow = 0
xhigh = 2.0068248990701997e-24
figMassxHist = plt.figure()
axMassxHist = plt.axes()
axMassxHist.set_xlim([xlow, xhigh])
plt.ticklabel_format(style='sci', axis='x', scilimits=(0, 0))
plt.bar(xbinmids, xbinned_ms, align='center')
生成的条形图为空。我想也许这些条太细了,看不到,所以尝试使用以下方法保存情节:
plt.savefig(gdir + "/m_x_pp.eps", format='eps', dpi = 72*5)
但结果仍然是空的。如何创建此数据的非空条形图?
【问题讨论】:
标签: python matplotlib histogram