79 chart histogram
Uncomment the following line to install geemap if needed.
In [ ]:
Copied!
# !pip install geemap
# !pip install geemap
Install the necessary libraries.
In [ ]:
Copied!
import ee
import geemap
import geemap.chart as chart
import ee
import geemap
import geemap.chart as chart
Initialize GEE.
In [ ]:
Copied!
geemap.ee_initialize()
geemap.ee_initialize()
Set the data and plot options.
In [ ]:
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 [ ]:
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 [ ]:
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 [ ]:
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 [ ]:
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 [ ]:
Copied!
chart.feature_histogram(my_sample, property, minBucketWidth=3, maxBuckets=30, **options)
chart.feature_histogram(my_sample, property, minBucketWidth=3, maxBuckets=30, **options)