Matplotlib / Seaborn: ValueError при аннотировании 2-го субплота (аннотация 1-го субплота прошла успешно) - PullRequest
0 голосов
/ 05 февраля 2020

Я создал эту фигуру с двумя вспомогательными участками и хотел аннотировать оба вспомогательных участка отдельно (см. Рисунок и код ниже)

enter image description here

    # Declare fig ax
    fig, ax = plt.subplots(2,1,figsize=[12,10], sharey=True)


    # Line plot for ax[0]
    sns.lineplot(x=['2020-01-01', '2020-01-31'], y=[32.7477, 49.6184], ax=ax[0], marker='o', markersize=10)

    # Add title for ax[0]
    ax[0].set(title='Figure 1', xlabel=None, ylabel="Index")
    ax[0].tick_params(axis = 'x', rotation = 45)

    # Annotation for ax[0]
    ax[0].text(0, 55, 52.53)
    ax[0].text(0.4, 45, "Some annotation here", horizontalalignment='center', size='medium', color='black')
    ax[0].text(1, 52, 49.62, horizontalalignment='center', size='medium', color='black')


    # Line plot for ax[1]
    sns.lineplot(x="date", y="ari", data=df_ari_jan, ax=ax[1],  marker='o', markersize=10)


    # Add title for ax[1]
    ax[1].set(title='Figure 2', xlabel=None, ylabel="Index")
    ax[1].set_xticks(df_ari_jan["date"].values)
    ax[1].tick_params(axis = 'x', rotation = 45)

    # Annotation for ax[1]
    ax[1].text(-1, 0, 52.53)
fig.tight_layout()

Аннотирование Первый подзаголовок был в порядке, но я продолжал получать это ValueError: Image size of 15006958x630 pixels is too large. It must be less than 2^16 in each direction. при попытке аннотировать 2-й.

fig.tight_layout() тоже не сработает UserWarning: Tight layout not applied. The left and right margins cannot be made large enough to accommodate all axes decorations.

Есть идеи, почему?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...