天天看點

Google Earth Engine(GEE)——特征和特征集合圖表概述和柱狀圖

該​

​ui.Chart.feature​

​​子產品包含從渲染圖的一組功能​

​Feature​

​​和​

​FeatureCollection​

​對象。函數的選擇決定了圖表中資料的排列方式,即定義 x 軸和 y 軸值的内容以及定義系列的内容。使用以下函數描述和示例來确定最适合您的函數和圖表類型。

圖表功能總體概述

使用以下繪圖作為視覺指南,了解每個函數如何在圖表中排列特征及其屬性;即,哪些元素定義了 x 值、y 值和系列。

​​ui.Chart.feature.byFeature​​

要素按標明屬性的值沿 x 軸繪制。系列由屬性名稱清單定義,其值沿 y 軸繪制。

Google Earth Engine(GEE)——特征和特征集合圖表概述和柱狀圖

​​ui.Chart.feature.byProperty​​

特征屬性按名稱沿 x 軸繪制;給定屬性的值沿 y 軸繪制。系列是由標明屬性的值标記的特征。

Google Earth Engine(GEE)——特征和特征集合圖表概述和柱狀圖

​​ui.Chart.feature.groups​​

要素按標明屬性的值沿 x 軸繪制。系列由給定屬性的唯一值定義。Y 軸位置由給定屬性的值定義。

Google Earth Engine(GEE)——特征和特征集合圖表概述和柱狀圖

​​ui.Chart.feature.histogram​​

所選屬性值的頻率直方圖。

  • X 軸:所選屬性值的直方圖桶
  • Y軸:符合每個直方圖桶的特征頻率

 簡單的舉例:

​ui.Chart.feature.byFeature​

從一組特征生成圖表。為每個特征繪制一個或多個屬性的值:

- X 軸 = 由 xProperty 标記的特征(預設值:'system:index')。

- Y 軸 = yProperties 的值(預設值:所有屬性)。

- 系列 = yProperties 的名稱。

值沿 x 軸以與輸入要素相同的順序排列。      

Generates a Chart from a set of features. Plots the value of one or more properties for each feature:

- X-axis = Features labeled by xProperty (default: 'system:index').

- Y-axis = Values of yProperties (default: all properties).

- Series = Names of yProperties.

The values are ordered along the x-axis in the same order as the input features.

Returns a chart.

Arguments:

功能(功能|功能集合|清單<功能>):
要包含在圖表中的功能。

xProperty(字元串,可選):
用作 x 軸上每個要素的值的屬性。預設為“系統:索引”。

yProperties(清單<字元串>|字元串,可選):
y 軸上使用的一個或多個屬性。如果省略,所有要素的所有屬性都将繪制在 y 軸上(xProperty 除外)。      

features (Feature|FeatureCollection|List<Feature>):

The features to include in the chart.

xProperty (String, optional):

The property used as the value of each feature on the x-axis. Defaults to 'system:index'.

yProperties (List<String>|String, optional):

Property or properties used on the y-axis. If omitted, all properties of all features will be charted on the y-axis (except xProperty).

Returns: ui.Chart

柱狀圖

Google Earth Engine(GEE)——特征和特征集合圖表概述和柱狀圖
// 導入一個矢量集合
var ecoregions = ee.FeatureCollection('projects/google/charts_feature_example');

// 定義圖表并列印到console中
var chart =
    ui.Chart.feature
        .byFeature({//選擇你要表示的波段名稱這裡是平均溫度
          features: ecoregions.select('[0-9][0-9]_tmean|label'),
          xProperty: 'label',//定義X的屬性
        })
        .setSeriesNames([
          'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
          'Nov', 'Dec'
        ])
        .setChartType('ColumnChart')//選擇類型
        .setOptions({//設定選高管圖表參數
          title: 'Average Monthly Temperature by Ecoregion',
          hAxis:
              {title: 'Ecoregion', titleTextStyle: {italic: false, bold: true}},
          vAxis: {
            title: 'Temperature (°C)',
            titleTextStyle: {italic: false, bold: true}
          },//圖例和圖表的内容的顔色
          colors: [
            '604791', '1d6b99', '39a8a7', '0f8755', '76b349', 'f0af07',
            'e37d05', 'cf513e', '96356f', '724173', '9c4f97', '696969'
          ]
        });
print(chart);      

繼續閱讀