Hi ALL,
I am doing a Temperature-Vegetation Dryness Index (TDVI) analysis using Normalized Difference Vegetation Index (NDVI) and Land Surface Temperature (LST) for drought assessment. I need to create a scatterplot of LST and NDVI. Can you help me do this in Python? or at least guide me on how to do this.
Thanks,
-Leo
Solved! Go to Solution.
conceptually, if you are doing this on a cell by cell basis, you could use RasterToNumpyArray to convert the rasters to arrays...then 'flatten' the arrays so they essentially become X, Y pairs, then you can use matplotlib to do the scatter plot
from matplotlib import pyplot as plt xs = [1,3,2,5,6,4] ys = [3,2,1,5,3,2] plt.scatter(xs, ys) main_title ="My first graph" plt.title(main_title, loc='center') #loc is either left, right or center plt.minorticks_on() plt.tick_params(which='major', direction='in', length=6, width=2) plt.tick_params(which='minor', direction='in', length=4, width=2) plt.show()
conceptually, if you are doing this on a cell by cell basis, you could use RasterToNumpyArray to convert the rasters to arrays...then 'flatten' the arrays so they essentially become X, Y pairs, then you can use matplotlib to do the scatter plot
from matplotlib import pyplot as plt xs = [1,3,2,5,6,4] ys = [3,2,1,5,3,2] plt.scatter(xs, ys) main_title ="My first graph" plt.title(main_title, loc='center') #loc is either left, right or center plt.minorticks_on() plt.tick_params(which='major', direction='in', length=6, width=2) plt.tick_params(which='minor', direction='in', length=4, width=2) plt.show()