问题描述
尽管我根据要绘制的输入数字更改了 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 (将#修改为@)