mirror of
https://github.com/macaodha/batdetect2.git
synced 2025-06-29 14:41:58 +02:00
23 lines
457 B
Python
23 lines
457 B
Python
"""General plotting utilities."""
|
|
|
|
from typing import Optional, Tuple
|
|
|
|
import matplotlib.pyplot as plt
|
|
from matplotlib import axes
|
|
|
|
__all__ = [
|
|
"create_ax",
|
|
]
|
|
|
|
|
|
def create_ax(
|
|
ax: Optional[axes.Axes] = None,
|
|
figsize: Tuple[int, int] = (10, 10),
|
|
**kwargs,
|
|
) -> axes.Axes:
|
|
"""Create a new axis if none is provided"""
|
|
if ax is None:
|
|
_, ax = plt.subplots(figsize=figsize, **kwargs) # type: ignore
|
|
|
|
return ax # type: ignore
|