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

ui.Chart.feature模块包含从渲染图的一组功能FeatureFeatureCollection对象。函数的选择决定了图表中数据的排列方式,即定义 x 轴和 y 轴值的内容以及定义系列的内容。使用以下函数描述和示例来确定最适合您的函数和图表类型。

图表功能总体概述

使用以下绘图作为视觉指南,了解每个函数如何在图表中排列特征及其属性;即,哪些元素定义了 x 值、y 值和系列。

ui.Chart.feature.byFeature

要素按选定属性的值沿 x 轴绘制。系列由属性名称列表定义,其值沿 y 轴绘制。

ui.Chart.feature.byProperty

特征属性按名称沿 x 轴绘制;给定属性的值沿 y 轴绘制。系列是由选定属性的值标记的特征。

ui.Chart.feature.groups

要素按选定属性的值沿 x 轴绘制。系列由给定属性的唯一值定义。Y 轴位置由给定属性的值定义。

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

柱状图

 特征沿 x 轴绘制,由选定属性的值标记。系列由属性名称列表定义的相邻列表示,其值沿 y 轴绘制。

// 导入一个矢量集合
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);

下一篇会接着写关于条形图和堆积柱状图!

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

此星光明

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值