@verbose
def plot_cov(cov, info, exclude=(), colorbar=True, proj=False, show_svd=True, show=True, verbose=None):
    "Plot Covariance data.\n\n    Parameters\n    ----------\n    cov : instance of Covariance\n        The covariance matrix.\n    info : dict\n        Measurement info.\n    exclude : list of str | str\n        List of channels to exclude. If empty do not exclude any channel.\n        If 'bads', exclude info['bads'].\n    colorbar : bool\n        Show colorbar or not.\n    proj : bool\n        Apply projections or not.\n    show_svd : bool\n        Plot also singular values of the noise covariance for each sensor\n        type. We show square roots ie. standard deviations.\n    show : bool\n        Show figure if True.\n    %(verbose)s\n\n    Returns\n    -------\n    fig_cov : instance of matplotlib.figure.Figure\n        The covariance plot.\n    fig_svd : instance of matplotlib.figure.Figure | None\n        The SVD spectra plot of the covariance.\n\n    See Also\n    --------\n    mne.compute_rank\n\n    Notes\n    -----\n    For each channel type, the rank is estimated using\n    :func:`mne.compute_rank`.\n\n    .. versionchanged:: 0.19\n       Approximate ranks for each channel type are shown with red dashed lines.\n    "
    from ..cov import Covariance
    import matplotlib.pyplot as plt
    from matplotlib.colors import Normalize
    (info, C, ch_names, idx_names) = _index_info_cov(info, cov, exclude)
    del cov, exclude
    projs = []
    if proj:
        projs = copy.deepcopy(info['projs'])
        for p in projs:
            p['active'] = True
        (P, ncomp, _) = make_projector(projs, ch_names)
        if (ncomp > 0):
            logger.info(('    Created an SSP operator (subspace dimension = %d)' % ncomp))
            C = np.dot(P, np.dot(C, P.T))
        else:
            logger.info('    The projection vectors do not apply to these channels.')
    (fig_cov, axes) = plt.subplots(1, len(idx_names), squeeze=False, figsize=((3.8 * len(idx_names)), 3.7))
    for (k, (idx, name, _, _, _)) in enumerate(idx_names):
        vlim = np.max(np.abs(C[idx][:, idx]))
        im = axes[(0, k)].imshow(C[idx][:, idx], interpolation='nearest', norm=Normalize(vmin=(- vlim), vmax=vlim), cmap='RdBu_r')
        axes[(0, k)].set(title=name)
        if colorbar:
            from mpl_toolkits.axes_grid1 import make_axes_locatable
            divider = make_axes_locatable(axes[(0, k)])
            cax = divider.append_axes('right', size='5.5%', pad=0.05)
            plt.colorbar(im, cax=cax, format='%.0e')
    fig_cov.subplots_adjust(0.04, 0.0, 0.98, 0.94, 0.2, 0.26)
    tight_layout(fig=fig_cov)
    fig_svd = None
    if show_svd:
        (fig_svd, axes) = plt.subplots(1, len(idx_names), squeeze=False, figsize=((3.8 * len(idx_names)), 3.7))
        for (k, (idx, name, unit, scaling, key)) in enumerate(idx_names):
            this_C = C[idx][:, idx]
            s = linalg.svd(this_C, compute_uv=False)
            this_C = Covariance(this_C, [info['ch_names'][ii] for ii in idx], [], [], 0)
            this_info = pick_info(info, idx)
            this_info['projs'] = []
            this_rank = compute_rank(this_C, info=this_info)
            s[(s <= 0)] = (1e-10 * s[(s > 0)].min())
            s = (np.sqrt(s) * scaling)
            axes[(0, k)].plot(s, color='k', zorder=3)
            this_rank = this_rank[key]
            axes[(0, k)].axvline((this_rank - 1), ls='--', color='r', alpha=0.5, zorder=4, clip_on=False)
            axes[(0, k)].text((this_rank - 1), axes[(0, k)].get_ylim()[1], ('rank ≈ %d' % (this_rank,)), ha='right', va='top', color='r', alpha=0.5, zorder=4)
            axes[(0, k)].set(ylabel=(u'Noise σ (%s)' % unit), yscale='log', xlabel='Eigenvalue index', title=name, xlim=[0, (len(s) - 1)])
        tight_layout(fig=fig_svd)
    plt_show(show)
    return (fig_cov, fig_svd)
Plot Covariance data.

Parameters
----------
cov : instance of Covariance
    The covariance matrix.
info : dict
    Measurement info.
exclude : list of str | str
    List of channels to exclude. If empty do not exclude any channel.
    If 'bads', exclude info['bads'].
colorbar : bool
    Show colorbar or not.
proj : bool
    Apply projections or not.
show_svd : bool
    Plot also singular values of the noise covariance for each sensor
    type. We show square roots ie. standard deviations.
show : bool
    Show figure if True.
%(verbose)s

Returns
-------
fig_cov : instance of matplotlib.figure.Figure
    The covariance plot.
fig_svd : instance of matplotlib.figure.Figure | None
    The SVD spectra plot of the covariance.

See Also
--------
mne.compute_rank

Notes
-----
For each channel type, the rank is estimated using
:func:`mne.compute_rank`.

.. versionchanged:: 0.19
   Approximate ranks for each channel type are shown with red dashed lines.
@verbose
def plot_cov(cov, info, exclude=(), colorbar=True, proj=False, show_svd=True, show=True, verbose=None):
    "Plot Covariance data.\n\n    Parameters\n    ----------\n    cov : instance of Covariance\n        The covariance matrix.\n    info : dict\n        Measurement info.\n    exclude : list of str | str\n        List of channels to exclude. If empty do not exclude any channel.\n        If 'bads', exclude info['bads'].\n    colorbar : bool\n        Show colorbar or not.\n    proj : bool\n        Apply projections or not.\n    show_svd : bool\n        Plot also singular values of the noise covariance for each sensor\n        type. We show square roots ie. standard deviations.\n    show : bool\n        Show figure if True.\n    %(verbose)s\n\n    Returns\n    -------\n    fig_cov : instance of matplotlib.figure.Figure\n        The covariance plot.\n    fig_svd : instance of matplotlib.figure.Figure | None\n        The SVD spectra plot of the covariance.\n\n    See Also\n    --------\n    mne.compute_rank\n\n    Notes\n    -----\n    For each channel type, the rank is estimated using\n    :func:`mne.compute_rank`.\n\n    .. versionchanged:: 0.19\n       Approximate ranks for each channel type are shown with red dashed lines.\n    "
    from ..cov import Covariance
    import matplotlib.pyplot as plt
    from matplotlib.colors import Normalize
    (info, C, ch_names, idx_names) = _index_info_cov(info, cov, exclude)
    del cov, exclude
    projs = []
    if proj:
        projs = copy.deepcopy(info['projs'])
        for p in projs:
            p['active'] = True
        (P, ncomp, _) = make_projector(projs, ch_names)
        if (ncomp > 0):
            logger.info(('    Created an SSP operator (subspace dimension = %d)' % ncomp))
            C = np.dot(P, np.dot(C, P.T))
        else:
            logger.info('    The projection vectors do not apply to these channels.')
    (fig_cov, axes) = plt.subplots(1, len(idx_names), squeeze=False, figsize=((3.8 * len(idx_names)), 3.7))
    for (k, (idx, name, _, _, _)) in enumerate(idx_names):
        vlim = np.max(np.abs(C[idx][:, idx]))
        im = axes[(0, k)].imshow(C[idx][:, idx], interpolation='nearest', norm=Normalize(vmin=(- vlim), vmax=vlim), cmap='RdBu_r')
        axes[(0, k)].set(title=name)
        if colorbar:
            from mpl_toolkits.axes_grid1 import make_axes_locatable
            divider = make_axes_locatable(axes[(0, k)])
            cax = divider.append_axes('right', size='5.5%', pad=0.05)
            plt.colorbar(im, cax=cax, format='%.0e')
    fig_cov.subplots_adjust(0.04, 0.0, 0.98, 0.94, 0.2, 0.26)
    tight_layout(fig=fig_cov)
    fig_svd = None
    if show_svd:
        (fig_svd, axes) = plt.subplots(1, len(idx_names), squeeze=False, figsize=((3.8 * len(idx_names)), 3.7))
        for (k, (idx, name, unit, scaling, key)) in enumerate(idx_names):
            this_C = C[idx][:, idx]
            s = linalg.svd(this_C, compute_uv=False)
            this_C = Covariance(this_C, [info['ch_names'][ii] for ii in idx], [], [], 0)
            this_info = pick_info(info, idx)
            this_info['projs'] = []
            this_rank = compute_rank(this_C, info=this_info)
            s[(s <= 0)] = (1e-10 * s[(s > 0)].min())
            s = (np.sqrt(s) * scaling)
            axes[(0, k)].plot(s, color='k', zorder=3)
            this_rank = this_rank[key]
            axes[(0, k)].axvline((this_rank - 1), ls='--', color='r', alpha=0.5, zorder=4, clip_on=False)
            axes[(0, k)].text((this_rank - 1), axes[(0, k)].get_ylim()[1], ('rank ≈ %d' % (this_rank,)), ha='right', va='top', color='r', alpha=0.5, zorder=4)
            axes[(0, k)].set(ylabel=(u'Noise σ (%s)' % unit), yscale='log', xlabel='Eigenvalue index', title=name, xlim=[0, (len(s) - 1)])
        tight_layout(fig=fig_svd)
    plt_show(show)
    return (fig_cov, fig_svd)