heatmap

petrophys.visualization.heatmap

Also available as petrophys.heatmap

heatmap(
matrix,
x=None,
y=None,
figsize=(7, 10),
title=None,
xlabel=None,
ylabel=None,
cmap='viridis',
invert_yaxis=True,
colorbar_label=None,
log_color=False,
values=None,
ax=None,
)[source]

2-D intensity map, e.g. an NMR T2-distribution vs depth or a binned density crossplot.

Parameters:
  • matrix (array-like, shape (n_y, n_x)) – Cell values; NaN cells are left blank.

  • x (array-like, optional) – Cell coordinates along each axis: either the n cell centres (e.g. T2 bin centres, sample depths) or the n + 1 cell edges. Each cell is drawn centred on its coordinate. Log-spaced centres such as T2 bins get log-symmetric cells, so ax.set_xscale("log") shows them correctly. When omitted, cells are indexed 0..n.

  • y (array-like, optional) – Cell coordinates along each axis: either the n cell centres (e.g. T2 bin centres, sample depths) or the n + 1 cell edges. Each cell is drawn centred on its coordinate. Log-spaced centres such as T2 bins get log-symmetric cells, so ax.set_xscale("log") shows them correctly. When omitted, cells are indexed 0..n.

  • figsize ((float, float)) – Figure size in inches, used when ax is not given.

  • title (str, optional) – Axes title.

  • xlabel (str, optional) – Axis labels; blank by default.

  • ylabel (str, optional) – Axis labels; blank by default.

  • cmap (str) – Matplotlib colour map name.

  • invert_yaxis (bool) – Show y increasing downwards, like a depth track.

  • colorbar_label (str, optional) – Label of the colour bar.

  • log_color (bool) – Log-scaled colour (LogNorm).

  • values (str, optional) – Format of each cell’s value written in the cell, e.g. "{:.2f}".

  • ax (matplotlib Axes, optional) – Axes to draw on.

Returns:

.fig and .ax; .save(path). Shows itself at the end of a notebook cell.

Return type:

Plot