3

I am harmonizing Landsat 8 and Sentinel-2 datasets for agricultural mapping purposes. When plotting the results using ui.Chart.image.series function, one graph shows the y-axis starting not at 0. For comparison purposes I need the y-axis on the charts to start at zero. How to adjust the below command to force y-axis to start at zero?

// Plot the fitted model and the original data at the ROI.
print(ui.Chart.image.series(fittedHarmonicboth.select(['fitted','NDVI']), roi, ee.Reducer.mean(), 10)
    .setOptions({
      title: 'Harmonic model: both S2 and L8 values',
      lineWidth: 1,
      pointSize: 3,
}));

2 Answers 2

2

Within your options you should add the vAxis.minValue, such as:

print(ui.Chart.image.series(fittedHarmonicboth.select(['fitted','NDVI']), roi, ee.Reducer.mean(), 10)
    .setOptions({
      title: 'Harmonic model: both S2 and L8 values',
      lineWidth: 1,
      pointSize: 3,
      vAxis: {minValue:0},
}));

More options are shown here.

0

Add the limits with vAxis: {viewWindow: }}

print(ui.Chart.image.series(fittedHarmonicboth.select(['fitted','NDVI']), roi, ee.Reducer.mean(), 10)
    .setOptions({
      title: 'Harmonic model: both S2 and L8 values',
      lineWidth: 1,
      pointSize: 3,
      vAxis: {viewWindow: {min: 0}},
}));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.