import numpy as np import matplotlib.pyplot as plt # ── Parameters ───────────────────────────────────────────────────────────── seed = 1107 size = 44 colormap = "viridis" 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.752101 * np.exp( -((X - 0.030516)**2 / (2 * 1.124426**2) + (Y - -0.325037)**2 / (2 * 1.361934**2)) ) Z += 1.160233 * np.exp( -((X - 1.695975)**2 / (2 * 0.976839**2) + (Y - 0.405561)**2 / (2 * 1.363448**2)) ) Z += -1.796815 * np.exp( -((X - 0.906230)**2 / (2 * 0.602012**2) + (Y - 1.013546)**2 / (2 * 0.735781**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()