NCAR / watershed_tools

Methods for creating watershed discretizations for use in hydrological modeling or analysis. Examples use the SUMMA modeling Framework.
GNU General Public License v3.0
11 stars 5 forks source link

revise raster_plot #7

Closed h294liu closed 2 years ago

h294liu commented 3 years ago

The raster plot mismatch issue is fixed by adding "norm" instance to the plot function "rasterio.plot.show". Norm is used to assign each color to a bin. The bin list is based on the unique values of the raster data. References are listed below. https://www.earthdatascience.org/courses/scientists-guide-to-plotting-data-in-python/plot-spatial-data/customize-raster-plots/customize-matplotlib-raster-maps/ https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.imshow.html

h294liu commented 3 years ago

The second commit 7856911 fixes the problem that plots are not shown on jupyter notebook. This is probably caused by user's IPython configuration of the interactive mode. In this commit, I add "plt.ion()" to enable the interactive mode, thus plots can be shown. Reference is listed below. https://matplotlib.org/stable/users/interactive.html