我正在尝试创建一个单像素的GPP和LAI的时间序列图像图表。就考虑到值而言,该图看起来很好。我想为两个y轴都添加一个标题,并使两个y轴的最小值都为0。我想发布一张我目前拥有的图形的图片,但堆栈溢出不允许我这样做。
下面是脚本:
https://code.earthengine.google.com/18dedf6d2e871cfb9ce1869f15dd0d80
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);发布于 2021-04-15 05:18:30
我通过更改一个字母来回答这个问题。使用vAxes!而不是vAxis!要设置每个y轴的最小值,只需在每个y轴中添加viewWindow:{min: 0}即可。
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);https://stackoverflow.com/questions/67096960
复制相似问题