Try using plt.figure() before your set up the plot. For example, the following works for me in SMC:
fig=plt.figure()