如何解决Matplotlib 没有在水平条形图上绘制多个点?
尽管我根据要绘制的输入数字更改了 x 限制,但 Matplotlib 似乎没有绘制多个点。 (x-limit 因为这是一个水平条形图)。
代码如下:
low = min(df_grouped_underlying['Currency Exposure'].astype(float))
high = max(df_grouped_underlying['Currency Exposure'].astype(float))
fig = plt.figure()
ax = fig.add_subplot()
ax.set_xlim([math.ceil(low-0.5*(high-low)),math.ceil(high+0.5*(high-low))])
bar_1 = ax.barh(df_grouped_underlying.index,df_grouped_underlying['Currency Exposure'].astype(float),label='Currency Exposure')
ax.set(title = 'Currency_Exposure_Underlying_Position',ylabel = 'Underlying Currency',xlabel = 'Exposure')
plt.legend(loc="upper right")
plt.savefig('agg_exposure.png',bBox_inches='tight')
plt.show()
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。