def subspace_detector_plot(detector, stachans, size, **kwargs):
import matplotlib.pyplot as plt<EOL>if stachans == '<STR_LIT:all>' and not detector.multiplex:<EOL><INDENT>stachans = detector.stachans<EOL><DEDENT>elif detector.multiplex:<EOL><INDENT>stachans = [('<STR_LIT>', '<STR_LIT:U+0020>')]<EOL><DEDENT>if np.isinf(detector.dimension):<EOL><INDENT>msg = '<STR_LIT:U+0020>'.join(['<STR_LIT>',<EOL>'<STR_LIT>'])<EOL>warnings.warn(msg)<EOL>nrows = detector.v[<NUM_LIT:0>].shape[<NUM_LIT:1>]<EOL><DEDENT>else:<EOL><INDENT>nrows = detector.dimension<EOL><DEDENT>fig, axes = plt.subplots(nrows=nrows, ncols=len(stachans),<EOL>sharex=True, sharey=True, figsize=size)<EOL>x = np.arange(len(detector.u[<NUM_LIT:0>]), dtype=np.float32)<EOL>if detector.multiplex:<EOL><INDENT>x /= len(detector.stachans) * detector.sampling_rate<EOL><DEDENT>else:<EOL><INDENT>x /= detector.sampling_rate<EOL><DEDENT>for column, stachan in enumerate(stachans):<EOL><INDENT>channel = detector.u[column]<EOL>for row, vector in enumerate(channel.T[<NUM_LIT:0>:nrows]):<EOL><INDENT>if len(stachans) == <NUM_LIT:1>:<EOL><INDENT>if nrows == <NUM_LIT:1>:<EOL><INDENT>axis = axes<EOL><DEDENT>else:<EOL><INDENT>axis = axes[row]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>axis = axes[row, column]<EOL><DEDENT>if row == <NUM_LIT:0>:<EOL><INDENT>axis.set_title('<STR_LIT:.>'.join(stachan))<EOL><DEDENT>axis.plot(x, vector, '<STR_LIT:k>', linewidth=<NUM_LIT>)<EOL>if column == <NUM_LIT:0>:<EOL><INDENT>axis.set_ylabel('<STR_LIT>' % (row + <NUM_LIT:1>), rotation=<NUM_LIT:0>)<EOL><DEDENT>if row == nrows - <NUM_LIT:1>:<EOL><INDENT>axis.set_xlabel('<STR_LIT>')<EOL><DEDENT>axis.set_yticks([])<EOL><DEDENT><DEDENT>plt.subplots_adjust(hspace=<NUM_LIT>)<EOL>plt.subplots_adjust(wspace=<NUM_LIT>)<EOL>fig = _finalise_figure(fig=fig, **kwargs)  <EOL>return fig<EOL>
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

>>> from eqcorrscan.core import subspace
>>> import os
>>> detector = subspace.Detector()
>>> detector.read(os.path.join(
...    os.path.abspath(os.path.dirname(__file__)),
...    '..', 'tests', 'test_data', 'subspace',
...    'stat_test_detector.h5'))
Detector: Tester
>>> subspace_detector_plot(detector=detector, stachans='all', size=(10, 7),
...                        show=True) # doctest: +SKIP

.. 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)