Heat map

ba.plot_heatmap draws a 2D Datafield with physical axis labels. ba.plot_datafield selects it automatically for 2D data. Use help(ba.plot_heatmap) for all options and their defaults.

Colors and intensity scales

cmap chooses the colors; norm maps intensity values onto that color scale. The default is a logarithmic scale with the inferno colormap:

image = ba.plot_heatmap(result, cmap='viridis')

For nonnegative intensities, a perceptually uniform sequential colormap makes changes in value easier to compare. See MatPlotLib’s colormap guide. For signed differences, combine a linear scale centered on zero with a diverging colormap such as coolwarm.

Compare images on one scale

A fixed normalization keeps the same intensity mapped to the same color across panels or successive fit updates. ba.intensity_norm constructs one from a Datafield or an array:

norm = ba.intensity_norm(experimental)
fig, (data_ax, model_ax) = ba.plt.subplots(1, 2)
ba.plot_heatmap(experimental, ax=data_ax, norm=norm, with_cb=True)
ba.plot_heatmap(simulated, ax=model_ax, norm=norm, with_cb=True)

Choose the reference data or explicit limits to cover the range you want to compare. An explicit norm controls the color scale instead of the intensity-limit options. Row and grid helpers already share a scale; they do not need separate normalization objects.

Mark excluded pixels

Use ba.plot_mask_overlay(mask, image) to mark True pixels in a boolean mask with the same shape as the image:

image = ba.plot_heatmap(result)
overlay = ba.plot_mask_overlay(mask, image)

The overlay leaves the intensities and color scale unchanged. To exclude pixels from a fit, use a residual function; the visual overlay does not change the objective. Fit-monitoring helpers can also show experimental data with the simulation’s mask applied visually.