def subspace_fc_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>pfs = []<EOL>for x in range(<NUM_LIT:1>, len(stachans)):<EOL><INDENT>if len(stachans) % x == <NUM_LIT:0>:<EOL><INDENT>pfs.append(x)<EOL><DEDENT><DEDENT>if stachans == [('<STR_LIT>', '<STR_LIT:U+0020>')]:<EOL><INDENT>ncols = <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>ncols = min(pfs,<EOL>key=lambda x: abs((np.floor(np.sqrt(len(stachans))) - x)))<EOL><DEDENT>nrows = len(stachans) // ncols<EOL>fig, axes = plt.subplots(nrows=nrows, ncols=ncols, sharex=True,<EOL>sharey=True, figsize=size, squeeze=False)<EOL>for column, axis in enumerate(axes.reshape(-<NUM_LIT:1>)):<EOL><INDENT>axis.set_title('<STR_LIT:.>'.join(stachans[column]))<EOL>sig = diagsvd(detector.sigma[column], detector.u[column].shape[<NUM_LIT:0>],<EOL>detector.v[column].shape[<NUM_LIT:0>])<EOL>A = np.dot(sig, detector.v[column])  <EOL>if detector.dimension > max(<EOL>detector.v[column].shape) or detector.dimension == np.inf:<EOL><INDENT>dim = max(detector.v[column].shape) + <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>dim = detector.dimension + <NUM_LIT:1><EOL><DEDENT>av_fc_dict = {i: [] for i in range(dim)}<EOL>for ai in A.T:<EOL><INDENT>fcs = []<EOL>for j in range(dim):<EOL><INDENT>av_fc_dict[j].append(float(np.dot(ai[:j].T, ai[:j])))<EOL>fcs.append(float(np.dot(ai[:j].T, ai[:j])))<EOL><DEDENT>axis.plot(fcs, color='<STR_LIT>')<EOL><DEDENT>avg = [np.average(_dim[<NUM_LIT:1>]) for _dim in av_fc_dict.items()]<EOL>axis.plot(avg, color='<STR_LIT>', linewidth=<NUM_LIT>)<EOL>if column % ncols == <NUM_LIT:0> or column == <NUM_LIT:0>:<EOL><INDENT>axis.set_ylabel('<STR_LIT>')<EOL><DEDENT>if column + <NUM_LIT:1> > len(stachans) - ncols:<EOL><INDENT>axis.set_xlabel('<STR_LIT>')<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>
Plot the fractional energy capture of the detector for all events in
the design set

: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_fc_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_fc_plot(detector=detector, stachans='all', size=(10, 7),
                           show=True)