diff --git a/modules/util/plot.py b/modules/util/plot.py index ea8f67b379ca1028f11667f59773c520e551f714..dfe6a0b4fc2868cde5fec283f3dabc13e9477044 100644 --- a/modules/util/plot.py +++ b/modules/util/plot.py @@ -157,23 +157,23 @@ def plot_roc_curve(correct_labels, prob_pos_class): plt.savefig(homedir+'test_roc', dpi=320) -def plot_image(image, fname=None, cmap='Greys', vmin=None, vmax=None): +def plot_image(image, cmap='Greys', vmin=None, vmax=None, fname=None, title=None, do_color_bar=True): Fig, ax = plt.subplots() # Plot the image 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) + if title is not None: + plt.title(os.path.basename(title), fontsize=10, fontweight='bold') # Add the colorbar - cbar = plt.colorbar(ticks=range(3)) - cbar.ax.set_position([0.90, 0.05, 0.03, 0.90]) # [left, bottom, width, height] - #cbar.ax.set_ylabel(label, rotation=90, fontsize=10) - #cbar.ax.tick_params(labelsize=10) - - # *Now* that the colorbar is out, we can set the plot's axis position - ax.set_position([0.05, 0.05, 0.83, 0.90]) # [left, bottom, width, height] + if do_color_bar: + cbar = plt.colorbar(ticks=range(3)) + cbar.ax.set_position([0.90, 0.05, 0.03, 0.90]) # [left, bottom, width, height] + #cbar.ax.set_ylabel(label, rotation=90, fontsize=10) + #cbar.ax.tick_params(labelsize=10) + + # *Now* that the colorbar is out, we can set the plot's axis position + ax.set_position([0.05, 0.05, 0.83, 0.90]) # [left, bottom, width, height] # Finish the figure settings and save to a file Fig.set_size_inches([10.0, 6.6], forward=True)