def get_ax_size(fig, ax):
    """Get the size of an axis

    Args:
     - fig: figure handle
     - ax: the axis handle

    Returns:
     - tuple: width, height

    Scraped from stackoverflow, noref.
    """
    bbox = ax.get_window_extent().transformed(fig.dpi_scale_trans.inverted())
    width, height = bbox.width, bbox.height
    width *= fig.dpi
    height *= fig.dpi
    return width, height