Created
March 4, 2021 16:52
-
-
Save jdbcode/7374f3a17a59274be41ca8d7448a7531 to your computer and use it in GitHub Desktop.
[Medium] Embed code demo image collection series chart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import the example feature collection and subset the forest feature. | |
var forest = ee.FeatureCollection('projects/google/charts_feature_example') | |
.filter(ee.Filter.eq('label', 'Forest')); | |
// Load MODIS vegetation indices data and subset a decade of images. | |
var vegIndices = ee.ImageCollection('MODIS/006/MOD13A1') | |
.filter(ee.Filter.date('2010-01-01', '2020-01-01')) | |
.select(['NDVI', 'EVI']); | |
// Define the chart and print it to the console. | |
var chart = | |
ui.Chart.image | |
.series({ | |
imageCollection: vegIndices, | |
region: forest, | |
reducer: ee.Reducer.mean(), | |
scale: 500, | |
xProperty: 'system:time_start' | |
}) | |
.setSeriesNames(['EVI', 'NDVI']) | |
.setOptions({ | |
title: 'Average Vegetation Index Value by Date for Forest', | |
hAxis: {title: 'Date', titleTextStyle: {italic: false, bold: true}}, | |
vAxis: { | |
title: 'Vegetation index (x1e4)', | |
titleTextStyle: {italic: false, bold: true} | |
}, | |
lineWidth: 5, | |
colors: ['e37d05', '1d6b99'], | |
curveType: 'function' | |
}); | |
print(chart); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment