from typing import Tuple from matplotlib import pyplot as plt from matplotlib.axes import Axes from matplotlib.figure import Figure def create_figure() -> Tuple[Figure, Axes]: """ helper function for matplotlib OOP interface with proper typing """ fig: Figure = plt.figure() ax: Axes = fig.gca() return fig, ax