The previous examples illustrated charting a series for a single region and charting
spectra at a single time for multiple regions. To get series for multiple regions, use
ui.Chart.image.seriesByRegion(). For example, the following code plots time
series of land surface temperature in three regions representing three land cover types:
// Define a FeatureCollection: regions of the American West.
var regions = ee.FeatureCollection([
ee.Feature( // San Francisco.
ee.Geometry.Rectangle(-122.45, 37.74, -122.4, 37.8), {label: 'City'}),
ee.Feature( // Tahoe National Forest.
ee.Geometry.Rectangle(-121, 39.4, -120.8, 39.8), {label: 'Forest'}),
ee.Feature( // Black Rock Desert.
ee.Geometry.Rectangle(-119.15, 40.8, -119, 41), {label: 'Desert'})
]);
// Load Landsat 8 brightness temperature data for 1 year.
var temps2013 = ee.ImageCollection('LANDSAT/LC8_L1T_32DAY_TOA')
.filterDate('2012-12-25', '2013-12-25')
.select('B11');
// Create a time series chart.
var tempTimeSeries = ui.Chart.image.seriesByRegion(
temps2013, regions, ee.Reducer.mean(), 'B11', 200, 'system:time_start', 'label')
.setChartType('ScatterChart')
.setOptions({
title: 'Temperature over time in regions of the American West',
vAxis: {title: 'Temperature (Kelvin)'},
lineWidth: 1,
pointSize: 4,
series: {
0: {color: 'FF0000'}, // urban
1: {color: '00FF00'}, // forest
2: {color: '0000FF'} // desert
}});
// Display.
print(tempTimeSeries);
The result should look something like Figure 1.