(2e) Optional Raster value histogram - (0 point)
Use your previous skills with
matplotlibto create a histogram of the raster values from the original NDVI raster (before reclassification). The histogram should visualize the distribution of NDVI values across the dataset, providing insights into the spread and frequency of different vegetation index values. Customize the bins and labels as needed to make the plot clear and informative.
matplotlibについて習得したスキルを使って、もともとのNDVI(正規化植生指標)ラスタ(再分類前)の値から、ヒストグラムを作ってください。
このヒストグラムはそのデータセット全体のNDVI(正規化植生指標)の分布を可視化し、植生指標の広がりと頻度に関する洞察を提供します。
必要に応じて、ビンとラベルをカスタマイズして、ヒストグラムをより明確で有益にしてください。
import matplotlib.pyplot as plt
import numpy as np
# 一次元に
ndvi_vector = ndvi_raster.values.flatten()
plt.figure(figsize=(10, 7))
plt.hist(ndvi_vector, bins=1000)
plt.xlabel("NDVI")
plt.ylabel("Frequency")
plt.title("NDVI Histogram")
plt.show()
ようやくLesson 7が終わりました。
次は、Final Assignmentです。
