if histplot is True:
hist_x = hist_percent
bin_labels = np.arange(0, bins)
dataset = pd.DataFrame({"Grayscale pixel intensity": bin_labels,
"Proportion of pixels (%)": hist_x})
fig_hist = (ggplot(data=dataset,
mapping=aes(x="Grayscale pixel intensity",
After Change
// Calculate histogram
hist_nir = [float(l[0]) for l in cv2.calcHist([gray_img], [0], mask, [bins], [0, maxval])]
// Create list of bin labels
bin_width = maxval / float(bins)
b = 0
bin_labels = [float(b)]
for i in range(bins - 1):
b += bin_width