ui.Chart.image.seriesByRegion

根据图片集合生成图表。提取并绘制集合中每张图片在每个区域中指定波段的值。通常是时间序列。

  - X 轴 = 由 xProperty 标记的图片(默认值:'system:time_start')。

  - Y 轴 = Reducer 输出。

  - 序列 = 由 seriesProperty 标记的区域(默认值:'system:index')。

返回图表。

用法返回
ui.Chart.image.seriesByRegion(imageCollection, regions, reducer, band, scale, xProperty, seriesProperty)ui.Chart
参数类型详细信息
imageCollectionImageCollection包含要纳入图表中的数据的 ImageCollection。
regionsFeature|FeatureCollection|Geometry|List<Feature>|List<Geometry>要缩减的区域。
reducer缩减器用于生成 y 轴值的精简器。必须返回单个值。
bandNumber|String,可选要使用精简器减少的频段名称。默认为第一个频段。
scale数字,可选用于与缩减器搭配使用的缩放比例(以米为单位)。
xProperty字符串,可选用作 x 轴上每张图片的标签的属性。默认值为“system:time_start”。
seriesProperty字符串,可选opt_regions 中用于序列标签的功能的属性。默认为“system:index”。

示例

代码编辑器 (JavaScript)

// Define regions of pixels to reduce and chart a time series for.
var regions = ee.FeatureCollection([
  ee.Feature(
    ee.Geometry.BBox(-121.916, 37.130, -121.844, 37.076), {label: 'Forest'}),
  ee.Feature(
    ee.Geometry.BBox(-122.438, 37.765, -122.396, 37.800), {label: 'Urban'})
]);

// Define an image collection time series to chart, MODIS vegetation indices
// in this case.
var imgCol = ee.ImageCollection('MODIS/006/MOD13A1')
  .filter(ee.Filter.date('2015-01-01', '2020-01-01'))
  .select(['NDVI', 'EVI']);

// Define the chart and print it to the console.
var chart = ui.Chart.image.seriesByRegion({
  imageCollection: imgCol,
  band: 'NDVI',
  regions: regions,
  reducer: ee.Reducer.mean(),
  scale: 500,
  seriesProperty: 'label',
  xProperty: 'system:time_start'
})
.setOptions({
  title: 'Average NDVI Value by Date',
  hAxis: {title: 'Date', titleTextStyle: {italic: false, bold: true}},
  vAxis: {
    title: 'NDVI (x1e4)',
    titleTextStyle: {italic: false, bold: true}
  },
  lineWidth: 5,
  colors: ['0f8755', '808080'],
});
print(chart);