plot_hist#

geetools.ImageAccessor.plot_hist(bins=30, region=None, bands=[], labels=[], colors=[], precision=2, ax=None, scale=10000, crs=None, crsTransform=None, bestEffort=False, maxPixels=10**7, tileScale=1, **kwargs)#

Plot the histogram of the image bands.

Parameters:
  • bins (int) – The number of bins to use for the histogram. Default is 30.

  • region (ee.Geometry | None) – The region to compute the histogram in. Default is the image geometry.

  • bands (list) – The bands to plot the histogram for. Default to all bands.

  • labels (list) – The labels to use for the output dictionary. Default to the band names.

  • colors (list) – The colors to use for the plot. Default to the default matplotlib colors.

  • prescision – The number of decimal to keep for the histogram bins values. Default is 2.

  • ax (matplotlib.axes.Axes | None) – The matplotlib axis to plot the data on. If None, a new figure is created.

  • scale (int) – The scale to use for the computation. Default is 10,000m.

  • crs (str | None) – The projection to work in. If unspecified, the projection of the image’s first band is used. If specified in addition to scale, rescaled to the specified scale.

  • crsTransform (list | None) – The list of CRS transform values. This is a row-major ordering of the 3x2 transform matrix. This option is mutually exclusive with ‘scale’, and replaces any transform already set on the projection.

  • bestEffort (bool) – If the polygon would contain too many pixels at the given scale, compute and use a larger scale which would allow the operation to succeed.

  • maxPixels (int) – The maximum number of pixels to reduce. default to 10**7.

  • tileScale (float) – A scaling factor between 0.1 and 16 used to adjust aggregation tile size; setting a larger tileScale (e.g., 2 or 4) uses smaller tiles and may enable computations that run out of memory with the default.

  • kwargs – Keyword arguments passed to the matplotlib fill_between() function.

  • precision (int)

Returns:

The matplotlib axis with the plot.

Return type:

matplotlib.axes.Axes

See also

  • byRegions: Compute a reducer in each region of the image for eah band.

  • byBands: Compute a reducer for each band of the image in each region.

  • plot_by_bands: Plot the reduced values for each bands.

  • :docstring:`ee.Image.geetools.plot_by_regions

Examples

import ee, geetools

ee.Initialize()

normClim = ee.ImageCollection('OREGONSTATE/PRISM/Norm91m').toBands()
normClim.plot_hist()