import numpy as np import matplotlib.pyplot as plt # ── Parameters ───────────────────────────────────────────────────────────── seed = 1108 size = 46 colormap = "magma" n_blobs = 2 # ── 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.535968 * np.exp( -((X - 0.430693)**2 / (2 * 1.167772**2) + (Y - -0.224632)**2 / (2 * 1.159165**2)) ) Z += -0.735556 * np.exp( -((X - 0.927038)**2 / (2 * 0.664675**2) + (Y - 1.149864)**2 / (2 * 1.131488**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()