Image size error in Stacked bar plot while adding plt.text()

I encounter the following error (Screenshot attached) when trying to add the numeric labels in the stacked bar plot. I referred to the video and typed the exact same code and still encountered the error.
Please help me slve this as i am not able to find where it arises from

Error message:
ValueError: Image size of 12441x3648032 pixels is too large. It must be less than 2^16 in each direction.

SEARCH STACK OVERFLOW

Can you share error screenshot after expanding the error description (click on that 6 frames and it will expand to give more details)?
Or you can share a link to your notebook.

1 Like

Yes, i am sharing the link to my notebook
https://colab.research.google.com/drive/1Ef7WE3hm0CqlB56Vni9KbyGCocOJ9x1h?usp=sharing

Can you remove plt.show( ) (or move it after the for loop)? It will fix the error.
plt.show() seems to be resetting the xlim, ylim values which seems to be causing the problem.

Here is the screenshot for xlim, ylim values I noticed while testing.

Note the printed values for xlim, ylim above and below the plot.

Thank you!! Removing it or moving it both solved it.

1 Like