import numpy as np import matplotlib.pyplot as plt # ── Parameters ───────────────────────────────────────────────────────────── seed = 1207 size = 40 colormap = "inferno" n_blobs = 1 # ── 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.030695 * np.exp( -((X - -0.210979)**2 / (2 * 0.564533**2) + (Y - 2.155113)**2 / (2 * 0.528459**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()