ui.Chart.image.seriesByRegion
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Tạo Biểu đồ từ một bộ sưu tập hình ảnh. Trích xuất và vẽ giá trị của dải tần được chỉ định trong mỗi khu vực cho từng hình ảnh trong tập hợp. Thường là một chuỗi thời gian.
– Trục X = Hình ảnh được gắn nhãn bằng xProperty (mặc định: "system:time_start").
– Trục Y = Đầu ra của bộ giảm tốc.
– Series = Khu vực được gắn nhãn bằng seriesProperty (mặc định: "system:index").
Trả về một biểu đồ.
Cách sử dụng | Giá trị trả về |
---|
ui.Chart.image.seriesByRegion(imageCollection, regions, reducer, band, scale, xProperty, seriesProperty) | ui.Chart |
Đối số | Loại | Thông tin chi tiết |
---|
imageCollection | ImageCollection | Một ImageCollection có dữ liệu sẽ được đưa vào biểu đồ. |
regions | Feature|FeatureCollection|Geometry|List<Feature>|List<Geometry> | Các khu vực cần giảm. |
reducer | Bộ giảm tốc | Hàm giảm tạo ra giá trị cho trục y. Phải trả về một giá trị duy nhất. |
band | Number|String, không bắt buộc | Tên dải tần cần giảm bằng cách sử dụng bộ giảm. Giá trị mặc định là dải tần đầu tiên. |
scale | Số, không bắt buộc | Tỷ lệ sử dụng với bộ giảm tốc theo mét. |
xProperty | Chuỗi, không bắt buộc | Thuộc tính sẽ được dùng làm nhãn cho từng hình ảnh trên trục x. Giá trị mặc định là "system:time_start". |
seriesProperty | Chuỗi, không bắt buộc | Thuộc tính của các đối tượng trong opt_regions sẽ được dùng cho nhãn của chuỗi. Mặc định là "system:index". |
Ví dụ
Trình soạn thảo mã (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);
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-25 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[[["\u003cp\u003eGenerates a chart that visualizes the change in a specific band's value over time within defined regions of an image collection.\u003c/p\u003e\n"],["\u003cp\u003eCharts the reducer output on the y-axis, time (or a specified property) on the x-axis, and uses regions as separate series.\u003c/p\u003e\n"],["\u003cp\u003eOffers customization options for the chart's appearance, such as titles, axes labels, line properties, and series colors, enabling detailed visual representation of the data.\u003c/p\u003e\n"],["\u003cp\u003eUses a reducer to summarize pixel values within each region for every image in the collection, allowing for analysis of trends and patterns.\u003c/p\u003e\n"],["\u003cp\u003eAccepts an image collection, regions of interest, a reducer, and optional parameters for band selection, scale, and property labeling for flexible data analysis and visualization.\u003c/p\u003e\n"]]],["This code generates a chart from an image collection, extracting and plotting band values per region. It uses `ui.Chart.image.seriesByRegion` with parameters: `imageCollection`, `regions`, `reducer`, `band`, `scale`, `xProperty`, and `seriesProperty`. The x-axis represents images labeled by `xProperty`, the y-axis shows the reducer's output, and series are labeled by `seriesProperty`. It takes data from an `imageCollection`, reduces it based on regions, and displays the results in a chart, frequently displaying a time series. An example provided uses MODIS vegetation indices.\n"],null,["# ui.Chart.image.seriesByRegion\n\n\u003cbr /\u003e\n\nGenerates a Chart from an image collection. Extracts and plots the value of the specified band in each region for each image in the collection. Usually a time series.\n\n\u003cbr /\u003e\n\n- X-axis = Image labeled by xProperty (default: 'system:time_start').\n\n- Y-axis = Reducer output.\n\n- Series = Region labeled by seriesProperty (default: 'system:index').\n\nReturns a chart.\n\n| Usage | Returns |\n|-------------------------------------------------------------------------------------------------------------------------------|----------|\n| `ui.Chart.image.seriesByRegion(imageCollection, regions, reducer, `*band* `, `*scale* `, `*xProperty* `, `*seriesProperty*`)` | ui.Chart |\n\n| Argument | Type | Details |\n|-------------------|-------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------|\n| `imageCollection` | ImageCollection | An ImageCollection with data to be included in the chart. |\n| `regions` | Feature\\|FeatureCollection\\|Geometry\\|List\\\u003cFeature\\\u003e\\|List\\\u003cGeometry\\\u003e | The regions to reduce. |\n| `reducer` | Reducer | Reducer that generates the value for the y-axis. Must return a single value. |\n| `band` | Number\\|String, optional | The band name to reduce using the reducer. Defaults to the first band. |\n| `scale` | Number, optional | Scale to use with the reducer in meters. |\n| `xProperty` | String, optional | Property to be used as the label for each image on the x-axis. Defaults to 'system:time_start'. |\n| `seriesProperty` | String, optional | Property of features in opt_regions to be used for series labels. Defaults to 'system:index'. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// Define regions of pixels to reduce and chart a time series for.\nvar regions = ee.FeatureCollection([\n ee.Feature(\n ee.Geometry.BBox(-121.916, 37.130, -121.844, 37.076), {label: 'Forest'}),\n ee.Feature(\n ee.Geometry.BBox(-122.438, 37.765, -122.396, 37.800), {label: 'Urban'})\n]);\n\n// Define an image collection time series to chart, MODIS vegetation indices\n// in this case.\nvar imgCol = ee.ImageCollection('MODIS/006/MOD13A1')\n .filter(ee.Filter.date('2015-01-01', '2020-01-01'))\n .select(['NDVI', 'EVI']);\n\n// Define the chart and print it to the console.\nvar chart = ui.Chart.image.seriesByRegion({\n imageCollection: imgCol,\n band: 'NDVI',\n regions: regions,\n reducer: ee.Reducer.mean(),\n scale: 500,\n seriesProperty: 'label',\n xProperty: 'system:time_start'\n})\n.setOptions({\n title: 'Average NDVI Value by Date',\n hAxis: {title: 'Date', titleTextStyle: {italic: false, bold: true}},\n vAxis: {\n title: 'NDVI (x1e4)',\n titleTextStyle: {italic: false, bold: true}\n },\n lineWidth: 5,\n colors: ['0f8755', '808080'],\n});\nprint(chart);\n```"]]