79 chart histogram
Uncomment the following line to install geemap if needed.
In [1]:
Copied!
# !pip install geemap
# !pip install geemap
Install the necessary libraries.
In [2]:
Copied!
import ee
import geemap
import geemap.chart as chart
import ee
import geemap
import geemap.chart as chart
Initialize GEE.
In [3]:
Copied!
geemap.ee_initialize()
geemap.ee_initialize()
Set the data and plot options.
In [4]:
Copied!
source = ee.ImageCollection('OREGONSTATE/PRISM/Norm81m').toBands()
region = ee.Geometry.Rectangle(-123.41, 40.43, -116.38, 45.14)
my_sample = source.sample(region, 5000)
property = '07_ppt'
source = ee.ImageCollection('OREGONSTATE/PRISM/Norm81m').toBands()
region = ee.Geometry.Rectangle(-123.41, 40.43, -116.38, 45.14)
my_sample = source.sample(region, 5000)
property = '07_ppt'
In [5]:
Copied!
options = {
"title": 'July Precipitation Distribution for NW USA',
"xlabel": 'Precipitation (mm)',
"ylabel": 'Pixel count',
"colors": ['#1d6b99'],
}
options = {
"title": 'July Precipitation Distribution for NW USA',
"xlabel": 'Precipitation (mm)',
"ylabel": 'Pixel count',
"colors": ['#1d6b99'],
}
Generate histogram with default number of bins:
In [6]:
Copied!
chart.feature_histogram(my_sample, property, **options)
chart.feature_histogram(my_sample, property, **options)
Generate histogram and set a maximum number of bins:
In [7]:
Copied!
chart.feature_histogram(my_sample, property, maxBuckets=30, **options)
chart.feature_histogram(my_sample, property, maxBuckets=30, **options)
Generate histogram and set a minimum bin size:
In [8]:
Copied!
chart.feature_histogram(my_sample, property, minBucketWidth=0.5, **options)
chart.feature_histogram(my_sample, property, minBucketWidth=0.5, **options)
Generate histogram, set a maximum number of bins and a minimum bin size:
In [9]:
Copied!
chart.feature_histogram(my_sample, property, minBucketWidth=3, maxBuckets=30, **options)
chart.feature_histogram(my_sample, property, minBucketWidth=3, maxBuckets=30, **options)
Last update:
2022-03-14