import numpy as np import matplotlib.pyplot as plt # ── Parameters ───────────────────────────────────────────────────────────── seed = 1106 size = 32 colormap = "plasma" n_blobs = 3 # ── Data ──────────────────────────────────────────────────────────────────── x = np.linspace(-3.0, 3.0, size) y = np.linspace(-2.0, 4.0, size) X, Y = np.meshgrid(x, y) Z = np.zeros((size, size)) Z += 1.666425 * np.exp( -((X - 1.615612)**2 / (2 * 0.894180**2) + (Y - -0.276676)**2 / (2 * 1.101107**2)) ) Z += 1.322780 * np.exp( -((X - 1.740748)**2 / (2 * 1.243475**2) + (Y - 2.774109)**2 / (2 * 1.357065**2)) ) Z += 0.516459 * np.exp( -((X - 1.474517)**2 / (2 * 1.320172**2) + (Y - 0.393135)**2 / (2 * 0.811748**2)) ) # ── Plot ──────────────────────────────────────────────────────────────────── fig, ax = plt.subplots(figsize=(6, 5)) im = ax.pcolormesh(X, Y, Z, cmap=colormap, shading="auto") fig.colorbar(im, ax=ax, label="Intensity") ax.set_title(f"Gaussian Heatmap ({n_blobs} blob(s))") ax.set_xlabel("X") ax.set_ylabel("Y") fig.tight_layout() plt.show()