Create a new figure for imshow if there is already data

This commit is contained in:
Steven Silvester
2014-12-13 08:57:14 -06:00
parent af2e6c3937
commit bc78bf8544
+2
View File
@@ -2,6 +2,8 @@ import matplotlib.pyplot as plt
def imshow(*args, **kwargs):
if plt.gca().has_data():
plt.figure()
kwargs.setdefault('interpolation', 'nearest')
kwargs.setdefault('cmap', 'gray')
plt.imshow(*args, **kwargs)