batdetect2/batdetect2/plotting/heatmaps.py
2024-04-24 10:06:04 -06:00

28 lines
506 B
Python

"""Plot heatmaps"""
from typing import Optional, Tuple
import matplotlib.pyplot as plt
import xarray as xr
from matplotlib import axes
from batdetect2.plotting.common import create_ax
def plot_heatmap(
heatmap: xr.DataArray,
ax: Optional[axes.Axes] = None,
figsize: Tuple[int, int] = (10, 10),
) -> axes.Axes:
ax = create_ax(ax, figsize=figsize)
ax.pcolormesh(
heatmap.time,
heatmap.frequency,
heatmap,
vmax=1,
vmin=0,
)
return ax