fig = plt.figure()
fig.patch.set_facecolor('blue')
fig.patch.set_alpha(0.7)
ax = fig.add_subplot(111)
ax.plot(list(range(10)))
ax.patch.set_facecolor('red')
ax.patch.set_alpha(0.5)
fig.savefig('temp.png', facecolor=fig.get_facecolor(), edgecolor='none')
plt.show()
How to set opacity of background colour of graph wit Matplotlib