# Buggy code
def _ensure_plottable(*args):
    """
    Raise exception if there is anything in args that can't be plotted on an
    axis by matplotlib.
    """
    numpy_types = [np.floating, np.integer, np.timedelta64, np.datetime64]
    other_types = [datetime]
    try:
        import cftime

        cftime_datetime = [cftime.datetime]
    except ImportError:
        cftime_datetime = []
    other_types = other_types + cftime_datetime
    for x in args:
        if not (
            _valid_numpy_subdtype(np.array(x), numpy_types)
            or _valid_other_type(np.array(x), other_types)
        ):
            raise TypeError(
                "Plotting requires coordinates to be numeric "
                "or dates of type np.datetime64, "
                "datetime.datetime, cftime.datetime or "
                "pd.Interval."
            )
        if (
            _valid_other_type(np.array(x), cftime_datetime)
            and not nc_time_axis_available
        ):
            raise ImportError(
                "Plotting of arrays of cftime.datetime "
                "objects or arrays indexed by "
                "cftime.datetime objects requires the "
                "optional `nc-time-axis` (v1.2.0 or later) "
                "package."
            )


# Traceback (TypeError)
TypeError                                 Traceback (most recent call last)
<ipython-input-22-d911786d1072> in <module>
----> 1 xarray.DataArray([True, False]).plot()

~/python_venvs/python3/py3_18.04/lib/python3.6/site-packages/xarray/plot/plot.py in __call__(self, **kwargs)
463
464     def __call__(self, **kwargs):
--> 465         return plot(self._da, **kwargs)
466
467     @functools.wraps(hist)

~/python_venvs/python3/py3_18.04/lib/python3.6/site-packages/xarray/plot/plot.py in plot(darray, row, col, col_wrap, ax, hue, rtol, subplot_kws, **kwargs)
200     kwargs["ax"] = ax
201
--> 202     return plotfunc(darray, **kwargs)
203
204

~/python_venvs/python3/py3_18.04/lib/python3.6/site-packages/xarray/plot/plot.py in line(darray, row, col, figsize, aspect, size, ax, hue, x, y, xincrease, yincrease, xscale, yscale, xticks, yticks, xlim, ylim, add_legend, _labels, *args, **kwargs)
321         yplt_val = yplt.values
322
--> 323     _ensure_plottable(xplt_val, yplt_val)
324
325     primitive = ax.plot(xplt_val, yplt_val, *args, **kwargs)

~/python_venvs/python3/py3_18.04/lib/python3.6/site-packages/xarray/plot/utils.py in _ensure_plottable(*args)
510         ):
511             raise TypeError(
--> 512                 "Plotting requires coordinates to be numeric "
513                 "or dates of type np.datetime64, "
514                 "datetime.datetime, cftime.datetime or "

TypeError: Plotting requires coordinates to be numeric or dates of type np.datetime64, datetime.datetime, cftime.datetime or pd.Interval.

# Fixed code
def _ensure_plottable(*args):
    """
    Raise exception if there is anything in args that can't be plotted on an
    axis by matplotlib.
    """
    numpy_types = [np.floating, np.integer, np.timedelta64, np.datetime64, np.bool_]
    other_types = [datetime]
    try:
        import cftime

        cftime_datetime = [cftime.datetime]
    except ImportError:
        cftime_datetime = []
    other_types = other_types + cftime_datetime
    for x in args:
        if not (
            _valid_numpy_subdtype(np.array(x), numpy_types)
            or _valid_other_type(np.array(x), other_types)
        ):
            raise TypeError(
                "Plotting requires coordinates to be numeric, boolean, "
                "or dates of type numpy.datetime64, "
                "datetime.datetime, cftime.datetime or "
                f"pandas.Interval. Received data of type {np.array(x).dtype} instead."
            )
        if (
            _valid_other_type(np.array(x), cftime_datetime)
            and not nc_time_axis_available
        ):
            raise ImportError(
                "Plotting of arrays of cftime.datetime "
                "objects or arrays indexed by "
                "cftime.datetime objects requires the "
                "optional `nc-time-axis` (v1.2.0 or later) "
                "package."
            )