import numpy as np import matplotlib.pyplot as plt # ── Parameters ───────────────────────────────────────────────────────────── seed = 1305 size = 40 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 += -0.837552 * np.exp( -((X - 1.470197)**2 / (2 * 0.916384**2) + (Y - 0.091304)**2 / (2 * 0.836730**2)) ) Z += -1.512303 * np.exp( -((X - 1.008116)**2 / (2 * 0.686052**2) + (Y - -0.480896)**2 / (2 * 0.933090**2)) ) Z += -1.641695 * np.exp( -((X - -1.151197)**2 / (2 * 0.716581**2) + (Y - 0.111584)**2 / (2 * 1.385345**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()