@staticmethod<EOL><INDENT>def show_plots(fitdata, fitval, x=None, save=False, view='<STR_LIT>'):<DEDENT>
import matplotlib.pyplot as plt<EOL>plotinfo = collections.OrderedDict()<EOL>for tag in fitval:<EOL><INDENT>d = fitdata[tag]<EOL>f = fitval[tag]<EOL>plotinfo[tag] = (<EOL>numpy.arange(len(d))+<NUM_LIT:1> if x is None else x[tag],<EOL>gvar.mean(d), gvar.sdev(d),  gvar.mean(f), gvar.sdev(f)<EOL>)<EOL><DEDENT>plotinfo_keys = list(plotinfo.keys())<EOL>fig = plt.figure()<EOL>viewlist = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']<EOL>def onpress(event):<EOL><INDENT>if event is not None:<EOL><INDENT>try:    <EOL><INDENT>onpress.idx = int(event.key)<EOL><DEDENT>except ValueError:<EOL><INDENT>if event.key == '<STR_LIT:n>':<EOL><INDENT>onpress.idx += <NUM_LIT:1><EOL><DEDENT>elif event.key == '<STR_LIT:p>':<EOL><INDENT>onpress.idx -= <NUM_LIT:1><EOL><DEDENT>elif event.key == '<STR_LIT:v>':<EOL><INDENT>onpress.view = (onpress.view + <NUM_LIT:1>) % len(viewlist)<EOL><DEDENT>elif event.key == '<STR_LIT:r>':<EOL><INDENT>onpress.view = viewlist.index('<STR_LIT>')<EOL><DEDENT>elif event.key == '<STR_LIT:d>':<EOL><INDENT>onpress.view = viewlist.index('<STR_LIT>')<EOL><DEDENT>elif event.key == '<STR_LIT:l>':<EOL><INDENT>onpress.view = viewlist.index('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>return<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>onpress.idx = <NUM_LIT:0><EOL><DEDENT>if onpress.idx >= len(plotinfo_keys):<EOL><INDENT>onpress.idx = len(plotinfo_keys)-<NUM_LIT:1><EOL><DEDENT>elif onpress.idx < <NUM_LIT:0>:<EOL><INDENT>onpress.idx = <NUM_LIT:0><EOL><DEDENT>i = onpress.idx<EOL>k = plotinfo_keys[i]<EOL>x, g, dg, gth, dgth = plotinfo[k]<EOL>fig.clear()<EOL>plt.title("<STR_LIT>"<EOL>% (i, k))<EOL>dx = (max(x) - min(x)) / <NUM_LIT><EOL>plt.xlim(min(x)-dx, max(x)+dx)<EOL>plotview = viewlist[onpress.view]<EOL>if plotview in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>if plotview in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>plt.yscale('<STR_LIT>', nonposy='<STR_LIT>')<EOL><DEDENT>if plotview == '<STR_LIT>':<EOL><INDENT>plt.xscale('<STR_LIT>', nonposx='<STR_LIT>')<EOL><DEDENT>plt.ylabel(str(k) + '<STR_LIT>' % plotview)<EOL>if len(x) > <NUM_LIT:0>:<EOL><INDENT>if len(x) > <NUM_LIT:1>:<EOL><INDENT>plt.plot(x, gth, '<STR_LIT>')<EOL>plt.fill_between(<EOL>x, y2=gth + dgth, y1=gth - dgth,<EOL>color='<STR_LIT:r>', alpha=<NUM_LIT>,<EOL>)<EOL><DEDENT>else:<EOL><INDENT>extra_x = [x[<NUM_LIT:0>] * <NUM_LIT:0.5>, x[<NUM_LIT:0>] * <NUM_LIT>]<EOL>plt.plot(extra_x, <NUM_LIT:2> * [gth[<NUM_LIT:0>]], '<STR_LIT>')<EOL>plt.fill_between(<EOL>extra_x, y2=<NUM_LIT:2> * [gth[<NUM_LIT:0>] + dgth[<NUM_LIT:0>]],<EOL>y1=<NUM_LIT:2> * [gth[<NUM_LIT:0>] - dgth[<NUM_LIT:0>]],<EOL>color='<STR_LIT:r>', alpha=<NUM_LIT>,<EOL>)<EOL><DEDENT>plt.errorbar(x, g, dg, fmt='<STR_LIT:o>')<EOL><DEDENT><DEDENT>elif plotview == '<STR_LIT>':<EOL><INDENT>plt.ylabel(str(k)+'<STR_LIT>'+'<STR_LIT>'  + '<STR_LIT>' % plotview)<EOL>ii = (gth != <NUM_LIT:0.0>)       <EOL>if len(x[ii]) > <NUM_LIT:0>:<EOL><INDENT>if len(x[ii]) > <NUM_LIT:1>:<EOL><INDENT>plt.fill_between(<EOL>x[ii], y2=<NUM_LIT:1> + dgth[ii] / gth[ii],<EOL>y1=<NUM_LIT:1> - dgth[ii] / gth[ii],<EOL>color='<STR_LIT:r>', alpha=<NUM_LIT>,<EOL>)<EOL>plt.plot(x, numpy.ones(len(x), float), '<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>extra_x = [x[ii][<NUM_LIT:0>] * <NUM_LIT:0.5>, x[ii][<NUM_LIT:0>] * <NUM_LIT>]<EOL>plt.fill_between(<EOL>extra_x, y2=<NUM_LIT:2> * [<NUM_LIT:1> + dgth[ii][<NUM_LIT:0>]/gth[ii][<NUM_LIT:0>]],<EOL>y1=<NUM_LIT:2> * [<NUM_LIT:1> - dgth[ii][<NUM_LIT:0>]/gth[ii][<NUM_LIT:0>]],<EOL>color='<STR_LIT:r>', alpha=<NUM_LIT>,<EOL>)<EOL>plt.plot(extra_x, numpy.ones(<NUM_LIT:2>, float), '<STR_LIT>')<EOL><DEDENT>plt.errorbar(x[ii], g[ii]/gth[ii], dg[ii]/gth[ii], fmt='<STR_LIT:o>')<EOL><DEDENT><DEDENT>elif plotview == '<STR_LIT>':<EOL><INDENT>plt.ylabel('<STR_LIT>'.format(str(k))  + '<STR_LIT>' % plotview)<EOL>ii = (dg != <NUM_LIT:0.0>)       <EOL>if len(x[ii]) > <NUM_LIT:0>:<EOL><INDENT>if len(x[ii]) > <NUM_LIT:1>:<EOL><INDENT>plt.fill_between(<EOL>x[ii], y2=dgth[ii] / dg[ii],<EOL>y1=-dgth[ii] / dg[ii],<EOL>color='<STR_LIT:r>', alpha=<NUM_LIT><EOL>)<EOL>plt.plot(x, numpy.zeros(len(x), float), '<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>extra_x = [x[ii][<NUM_LIT:0>] * <NUM_LIT:0.5>, x[ii][<NUM_LIT:0>] * <NUM_LIT>]<EOL>plt.fill_between(<EOL>extra_x, y2=<NUM_LIT:2> * [dgth[ii][<NUM_LIT:0>] / dg[ii][<NUM_LIT:0>]],<EOL>y1=<NUM_LIT:2> * [-dgth[ii][<NUM_LIT:0>] / dg[ii][<NUM_LIT:0>]],<EOL>color='<STR_LIT:r>', alpha=<NUM_LIT><EOL>)<EOL>plt.plot(extra_x, numpy.zeros(<NUM_LIT:2>, float), '<STR_LIT>')<EOL><DEDENT>plt.errorbar(<EOL>x[ii], (g[ii] - gth[ii]) / dg[ii], dg[ii] / dg[ii],<EOL>fmt='<STR_LIT:o>'<EOL>)<EOL><DEDENT><DEDENT>if save:<EOL><INDENT>plt.savefig(save.format(k), bbox_inches='<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>plt.draw()<EOL><DEDENT><DEDENT>onpress.idx = <NUM_LIT:0><EOL>try:<EOL><INDENT>onpress.view = viewlist.index(view)<EOL><DEDENT>except ValueError:<EOL><INDENT>raise ValueError('<STR_LIT>' + str(view))<EOL><DEDENT>fig.canvas.mpl_connect('<STR_LIT>', onpress)<EOL>onpress(None)<EOL>plt.show()<EOL>
Show plots comparing ``fitdata[k],fitval[k]`` for each key ``k`` in ``fitval``.

        Assumes :mod:`matplotlib` is installed (to make the plots). Plots
        are shown for one correlator at a time. Press key ``n`` to see the
        next correlator; press key ``p`` to see the previous one; press key
        ``q`` to quit the plot and return control to the calling program;
        press a digit to go directly to one of the first ten plots. Zoom,
        pan and save using the window controls.

        There are several different views available for each plot,
        specified by parameter ``view``:

            ``view='ratio'``: Data divided by fit (default).

            ``view='diff'``: Data minus fit, divided by data's standard deviation.

            ``view='std'``: Data and fit.

            ``view='log'``: ``'std'`` with log scale on the vertical axis.

            ``view='loglog'``: `'std'`` with log scale on both axes.

        Press key ``v`` to cycle through these  views; or press keys
        ``r``, ``d``, or ``l`` for the ``'ratio'``, ``'diff'``,
        or ``'log'`` views, respectively.

        Copies of the plots that are viewed can be saved by setting parameter
        ``save=fmt`` where ``fmt`` is a string used to create
        file names: the file name for the plot corresponding to key
        ``k`` is ``fmt.format(k)``. It is important that the
        filename end with a suffix indicating the type of plot file
        desired: e.g., ``fmt='plot-{}.pdf'``.