import matplotlib.pyplot as plt
import numpy as np
# Create a fake histogram (just a curve for demonstration)
x = np.linspace(0, 1, 500)
hist = np.exp(-((x-0.2)/0.1)**2) + 0.5*np.exp(-((x-0.6)/0.15)**2)
fig, ax = plt.subplots(figsize=(8,5))
ax.plot(x, hist, color="black", lw=2)
ax.set_title("GHS: Stretch Factor vs Local Stretch Factor", fontsize=14, weight="bold")
ax.set_xlabel("Pixel Brightness (0=black, 1=white)")
ax.set_ylabel("Frequency")
# Mark a stretch point (SP) around 0.2
sp = 0.2
ax.axvline(sp, color="red", linestyle="--", lw=1.5)
ax.text(sp, 1.4, "SP (Stretch Point)", color="red", ha="center", fontsize=10, weight="bold")
# Add arrows showing effect of Stretch Factor (global)
ax.annotate("Stretch Factor (SF)\nGlobal boost everywhere",
xy=(0.6, hist.max()/2), xytext=(0.85, 1.3),
arrowprops=dict(arrowstyle="->", lw=2, color="blue"),
fontsize=10, color="blue", ha="center")
# Add arrows showing effect of Local Stretch Factor (around SP)
ax.annotate("Local Stretch Factor (LSF)\nBoost near SP",
xy=(sp, hist.max()), xytext=(0.35, 1.3),
arrowprops=dict(arrowstyle="->", lw=2, color="green"),
fontsize=10, color="green", ha="center")
plt.tight_layout()
plt.show()