I'm trying to plot a dataset about the exchange rate per Euro, all the codes are working perfectly, except the below code, I don't mind to change the code to something easier to read
style.use('fivethirtyeight')
plt.figure(figsize=(12, 6))
ax1 = plt.subplot(2,3,1)
ax2 = plt.subplot(2,3,2)
ax3 = plt.subplot(2,3,3)
ax4 = plt.subplot(2,1,2)
axes = [ax1, ax2, ax3, ax4]
for ax in axes:
ax.set_ylim(0.8, 1.7)
ax.set_yticks([1.0, 1.2, 1.4, 1.6])
ax.set_yticklabels(['1.0', '1.2','1.4', '1.6'],
alpha=0.3)
ax.grid(alpha=0.5)
ax1.plot(bush['Time'], bush['rolling_mean'],
color='#BF5FFF')
ax1.text(731516.0, 1.92, 'BUSH', fontsize=18, weight='bold',
color='#BF5FFF')
ax1.text(731216.0, 1.8, '2001-2009',
weight='bold', alpha=0.3)
ax1.set_xticklabels(['', '2001', '', '2003', '', '2005', '',
'2007', '', '2009'],
alpha=0.3)
ax2.plot(obama['Time'], obama['rolling_mean'],
color='#ffa500')
ax2.text(734288.0, 1.92, 'OBAMA', fontsize=18, weight='bold',
color='#ffa500')
ax2.text(734138.0, 1.8, '2009-2017',
weight='bold', alpha=0.3)
ax2.set_xticklabels(['', '2009', '', '2011', '', '2013', '',
'2015', '', '2017'],
alpha=0.3)
# visualising Trumps's period
ax3.plot(trump['Time'], trump['rolling_mean'],
color='#00B2EE')
ax3.text(736855.0, 1.92, 'TRUMP', fontsize=18, weight='bold',
color='#00B2EE')
ax3.text(736745.0, 1.8, '2009-2017',
weight='bold', alpha=0.3)
ax3.set_xticklabels(['2017', '', '2018', '', '2019', '',
'2020', '', '2021'],
alpha=0.3)
ax4.plot(bush['Time'], bush['rolling_mean'],
color='#BF5FFF')
ax4.plot(obama['Time'], obama['rolling_mean'],
color='#ffa500')
ax4.plot(trump['Time'], trump['rolling_mean'],
color='#00B2EE')
ax4.grid(alpha=0.5)
ax4.set_xticks([])
ax1.text(730016.0, 2.35, 'EURO-USD rate averaged 1.22 under the last three US presidents',
fontsize=20, weight='bold')
ax1.text(730016.0, 2.14, '''EURO-USD exchange rates under George W. Bush (2001 - 2009), Barack Obama (2009-2017),
and Donald Trump (2017-2021)''',
fontsize=16)
ax4.text(729916.0, 0.65, '©MAHA FOUAD' + ' '*103 + 'Source: European Central Bank',
color = '#f0f0f0', backgroundcolor = '#4d4d4d',
size=14)
plt.show()
I was expecting it to work perfectly, but I get the below error:
ValueError: Image size of 99792x523 pixels is too large. It must be less than 2^16 in each direction.