import numpy as np import matplotlib.pyplot as plt # ── Parameters ───────────────────────────────────────────────────────────── seed = 1905 size = 45 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 += -1.252087 * np.exp( -((X - -1.716627)**2 / (2 * 1.418281**2) + (Y - -0.529773)**2 / (2 * 1.283903**2)) ) Z += 1.412459 * np.exp( -((X - 1.529702)**2 / (2 * 1.447362**2) + (Y - -0.880475)**2 / (2 * 1.167849**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()