I am fairly new to ArcPy/Python and have been asked to do the following: Generate a histogram of bin counts based on an input 32-bit float raster image. I have generated the array for the image using ArcPy (ArcMap 10.4). The requirement is to determine the mean and stdev for this array (done as well with Numpy) and then set a new upper (max) and lower (min) value based on a 2.5 stdev spread across the mean (done too). This image data range must now go into an array with an arbitrary number of bins (say 20) each with a value width of ((new max - new min)/bins). Then I would need to count the total instances of values that fall within each bin, and plot to a histogram that can be saved. I have seen lots of promising information related to the Numpy and Matplotlib functions that can help in this regard, but can't seem to get it off the ground. At some point I will need to do the same for a variable number of input images (2 - 6 possible), determining the min and max values using stdev from all inputs, then plotting all based on this range. For now a single image would be a great start. Any suggestions greatly appreciated. Thanks.

A simple example

Now you can experiment with other options for testing.

Of course, you need to use RasterToNumPyArray to get rasters out to array format and reverse the process with NumPyArrayToFeatureClass..

Then you are off to matplotlib or seaborn for graphing.

Check out my blog, I have numerous example of numpy use there.