From de325e0ecc49c0d5badcf4ef2dc707a5feb235dc Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Tue, 17 May 2022 10:15:08 -0500 Subject: [PATCH] snapshot... --- modules/util/plot.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/util/plot.py b/modules/util/plot.py index a4cecbf1..41040f7a 100644 --- a/modules/util/plot.py +++ b/modules/util/plot.py @@ -157,11 +157,11 @@ def plot_roc_curve(correct_labels, prob_pos_class): plt.savefig('/home/rink/test_roc', dpi=320) -def plot_image(image, fname, label, cmap='Greys'): +def plot_image(image, fname=None, cmap='Greys', vmin=-1.5, vmax=2.5): Fig, ax = plt.subplots() # Plot the image - plt.imshow(image, interpolation="nearest", cmap=cmap, vmin=-1.5,vmax=2.5) + plt.imshow(image, interpolation="nearest", cmap=cmap, vmin=vmin, vmax=vmax) # plt.imshow(image, interpolation="nearest", cmap=cmap, vmin=-0.5,vmax=1.5) # plt.imshow(radGrid, interpolation = "nearest", cmap = cmap, vmin = vmin, vmax = vmax) # plt.title(os.path.basename(InFileWV), fontsize=10) @@ -178,11 +178,13 @@ def plot_image(image, fname, label, cmap='Greys'): # Finish the figure settings and save to a file Fig.set_size_inches([10.0, 6.6], forward=True) Fig.set_dpi(100) # This seems to not get applied. Always 100? - # Fig.show() # Display # Save to file - ImageDirAndName = os.path.join('/Users/tomrink', fname) - Fig.savefig(ImageDirAndName) + if fname is not None: + ImageDirAndName = os.path.join('/Users/tomrink', fname) + Fig.savefig(ImageDirAndName) + else: + Fig.show() # Wrap up Fig.clf() # Otherwise fig stays open every time -- GitLab