首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Google Earth引擎中的ui.Chart.image.series()创建用于时间序列像素分析的两个y轴

使用Google Earth引擎中的ui.Chart.image.series()创建用于时间序列像素分析的两个y轴
EN

Stack Overflow用户
提问于 2021-04-15 02:11:03
回答 1查看 240关注 0票数 0

我正在尝试创建一个单像素的GPP和LAI的时间序列图像图表。就考虑到值而言,该图看起来很好。我想为两个y轴都添加一个标题,并使两个y轴的最小值都为0。我想发布一张我目前拥有的图形的图片,但堆栈溢出不允许我这样做。

下面是脚本:

https://code.earthengine.google.com/18dedf6d2e871cfb9ce1869f15dd0d80

代码语言:javascript
复制
var chart = ui.Chart.image.series({
                                   imageCollection: modisVeg ,
                                   region: tree ,
                                   scale: 500   ,
                                   xProperty: 'system:index'
                                  })
                          .setSeriesNames(['GPP', 'LAI'])
                          .setOptions({
                            title: '[Time-series Analysis (2019)]: Tree Pixel' ,
                            series: {
                                     0: {
                                         targetAxisIndex: 0 ,
                                         type: "line" ,
                                         lineWidth: 5 ,
                                         pointSize: 0 ,
                                         color: "blue" 
                                        } ,
                                     1: {
                                         targetAxisIndex: 1 ,
                                         type: "line" ,
                                         lineWidth: 5 ,
                                         pointSize: 0 ,
                                         color: "green" 
                                        } ,
                                    } ,
                            hAxis: {
                                    title: 'Date' ,
                                    titleTextStyle: { italic: false, bold: true }
                                   } ,
                            vAxis: {
                                    0: {
                                        title: "GPP (g*C / m^2)" ,
                                        baseline: 0 ,
                                        titleTextStyle: { bold: true , color: 'blue' }
                                      } ,
                                    1: {
                                        title: "LAI" ,
                                        baseline: 0  ,
                                        titleTextStyle: { bold: true, color: 'green' }
                                      }
                                   } ,
                            curveType: 'function'
                          });

print(chart);
EN

回答 1

Stack Overflow用户

发布于 2021-04-15 05:18:30

我通过更改一个字母来回答这个问题。使用vAxes!而不是vAxis!要设置每个y轴的最小值,只需在每个y轴中添加viewWindow:{min: 0}即可。

代码语言:javascript
复制
var chart = ui.Chart.image.series({
                                   imageCollection: modisVeg ,                          // Image collection we want to use for timeseries analysis
                                   region: tree ,                                       // Pixel we want to use
                                   scale: 500   ,                                       // [Spatial Resolution]: 500
                                   xProperty: 'system:time_start'                       // Date 
                                  })
                          .setSeriesNames(['GPP', 'LAI'])
                          .setOptions({
                            title: '[Time-series Analysis (2019) ]: Tree Pixel' ,
                            series: {
                                     0: {
                                         targetAxisIndex: 0 ,
                                         type: "line" ,
                                         lineWidth: 5 ,
                                         pointSize: 0 ,
                                         color: "blue"
                                        } ,
                                     1: {
                                         targetAxisIndex: 1 ,
                                         type: "line" ,
                                         lineWidth: 5 ,
                                         pointSize: 0 ,
                                         color: "green" 
                                        } ,
                                    } ,
                            hAxis: {
                                    title: 'Date' ,
                                    format: "MM" ,
                                    titleTextStyle: { italic: false, bold: true }
                                   } ,
                            vAxes: {
                                    0: {
                                        title: "GPP (g*C / m^2 / day)" ,
                                        baseline: 0 ,
                                        titleTextStyle: { bold: true , color: 'blue' } ,
                                        viewWindow: { min: 0 }
                                      } ,
                                    1: {
                                        title: "LAI" ,
                                        baseline: 0  ,
                                        titleTextStyle: { bold: true, color: 'green' } ,
                                        viewWindow: { min: 0 }
                                      }
                                  } ,
                            curveType: 'function'
                          });

print("[Time-series for GPP (g*C / m^2 / day) and LAI]: " , chart);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67096960

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档