I want to automatically save some histograms from raster data as images as png and I am using rasterio.
My question is how to save histogram images without needing to show the histogram (because then I have to close the figure manual) or how to close the figure automatically with code.
Thanks.
from rasterio.plot import show_hist
raster='image path'
fig, ax = pyplot.subplots(figsize=(10, 6))
show_hist(raster, bins=50, lw=0.0, stacked=False, alpha=0.3,
histtype='stepfilled', title="Histogram")
fig.savefig(path)