def substring_in_axes(substring: str, ax: mpl.axes.Axes) -> bool:
    """
    Return True if a substring is found anywhere in an axes
    """
    alltxt: set[str] = {t.get_text() for t in ax.findobj(mpl.text.Text)}
    return any(substring in txt for txt in alltxt)

    Return True if a substring is found anywhere in an axes
    
xarray/tests/test_plot.py