0

Matplotlib appears to not be plotting several points despite me changing the x-limit based on the inputted numbers I am trying to graph. (x-limit because this is a horizontal barplot).

Here is the code:

    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()

Here is the output: Output of the plot

0 Answers0