<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def subspace_detector_plot(detector, stachans, size, **kwargs):
 """ Plotting for the subspace detector class. Plot the output basis vectors for the detector at the given dimension. Corresponds to the first n horizontal vectors of the V matrix. :type detector: :class:`eqcorrscan.core.subspace.Detector` :type stachans: list :param stachans: list of tuples of station, channel pairs to plot. :type stachans: list :param stachans: List of tuples of (station, channel) to use. Can set\ to 'all' to use all the station-channel pairs available. If \ detector is multiplexed, will just plot that. :type size: tuple :param size: Figure size. :returns: Figure :rtype: matplotlib.pyplot.Figure .. rubric:: Example Detector: Tester .. plot:: from eqcorrscan.core import subspace from eqcorrscan.utils.plotting import subspace_detector_plot import os print('running subspace plot') detector = subspace.Detector() detector.read(os.path.join('..', '..', '..', 'tests', 'test_data', 'subspace', 'stat_test_detector.h5')) subspace_detector_plot(detector=detector, stachans='all', size=(10, 7), show=True) """

    import matplotlib.pyplot as plt
    if stachans == 'all' and not detector.multiplex:
        stachans = detector.stachans
    elif detector.multiplex:
        stachans = [('multi', ' ')]
    if np.isinf(detector.dimension):
        msg = ' '.join(['Infinite subspace dimension. Only plotting as many',
                        'dimensions as events in design set'])
        warnings.warn(msg)
        nrows = detector.v[0].shape[1]
    else:
        nrows = detector.dimension
    fig, axes = plt.subplots(nrows=nrows, ncols=len(stachans),
                             sharex=True, sharey=True, figsize=size)
    x = np.arange(len(detector.u[0]), dtype=np.float32)
    if detector.multiplex:
        x /= len(detector.stachans) * detector.sampling_rate
    else:
        x /= detector.sampling_rate
    for column, stachan in enumerate(stachans):
        channel = detector.u[column]
        for row, vector in enumerate(channel.T[0:nrows]):
            if len(stachans) == 1:
                if nrows == 1:
                    axis = axes
                else:
                    axis = axes[row]
            else:
                axis = axes[row, column]
            if row == 0:
                axis.set_title('.'.join(stachan))
            axis.plot(x, vector, 'k', linewidth=1.1)
            if column == 0:
                axis.set_ylabel('Basis %s' % (row + 1), rotation=0)
            if row == nrows - 1:
                axis.set_xlabel('Time (s)')
            axis.set_yticks([])
    plt.subplots_adjust(hspace=0.05)
    plt.subplots_adjust(wspace=0.05)
    fig = _finalise_figure(fig=fig, **kwargs)  # pragma: no cover
    return fig