我用两个子图创建了这个图,并想分别注释两个子图(请参见下面的图和代码)
using (IEnumerator enumerator = this.listViewBoxes.Items.GetEnumerator())
{
while (enumerator.MoveNext())
{
object obj = enumerator.Current;
ListViewItem listViewItem = (ListViewItem)obj;
int num5 = 0;
int num6 = 0;
try
{
if (listViewItem.Tag.ToString() == "HEAD")
{
num5 = this.displayBox.Width / 2;
num6 = num + int.Parse(this.offsetHead.Text) * 5;
}
else if (listViewItem.Tag.ToString() == "BODY")
{
num5 = this.displayBox.Width / 2;
num6 = num + int.Parse(this.offsetBody.Text) * 5;
}
else if (listViewItem.Tag.ToString() == "ARM0")
{
num5 = this.displayBox.Width / 2 - 25;
num6 = num2 + int.Parse(this.offsetArms.Text) * 5;
}
else if (listViewItem.Tag.ToString() == "ARM1")
{
num5 = this.displayBox.Width / 2 + 25;
num6 = num2 + int.Parse(this.offsetArms.Text) * 5;
}
else if (listViewItem.Tag.ToString() == "LEG0")
{
num5 = this.displayBox.Width / 2 - 10;
num6 = num3 + int.Parse(this.offsetLegs.Text) * 5;
}
else if (listViewItem.Tag.ToString() == "LEG1")
{
num5 = this.displayBox.Width / 2 + 10;
num6 = num3 + int.Parse(this.offsetLegs.Text) * 5;
}
注释第一个子图很好,但是尝试注释第二个子图时,我一直得到这个 # 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.
都不起作用fig.tight_layout()
对为什么有任何想法吗?