<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def gof_plot( simdata, trueval, name=None, bins=None, format='png', suffix='-gof', path='./', fontmap=None, verbose=0):
 """ Plots histogram of replicated data, indicating the location of the observed data :Arguments: simdata: array or PyMC object Trace of simulated data or the PyMC stochastic object containing trace. trueval: numeric True (observed) value of the data bins: int or string The number of bins, or a preferred binning method. Available methods include 'doanes', 'sturges' and 'sqrt' (defaults to 'doanes'). format (optional):
 string Graphic output format (defaults to png). suffix (optional):
 string Filename suffix. path (optional):
 string Specifies location for saving plots (defaults to local directory). fontmap (optional):
 dict Font map for plot. """


    if fontmap is None:
        fontmap = {1: 10, 2: 8, 3: 6, 4: 5, 5: 4}

    if not isinstance(simdata, ndarray):
        ## Can't just try and catch because ndarray objects also have
        ## `trace` method.
        simdata = simdata.trace()

    if ndim(trueval) == 1 and ndim(simdata == 2):
        # Iterate over more than one set of data
        for i in range(len(trueval)):
            n = name or 'MCMC'
            gof_plot(
                simdata[
                    :,
                    i],
                trueval[
                    i],
                '%s[%i]' % (
                    n,
                    i),
                bins=bins,
                format=format,
                suffix=suffix,
                path=path,
                fontmap=fontmap,
                verbose=verbose)
        return

    if verbose > 0:
        print_('Plotting', (name or 'MCMC') + suffix)

    figure()

    # Specify number of bins
    if bins is None:
        bins = 'sqrt'
    uniquevals = len(unique(simdata))
    if bins == 'sturges':
        bins = uniquevals * (uniquevals <= 25) or _sturges(len(simdata))
    elif bins == 'doanes':
        bins = uniquevals * (
            uniquevals <= 25) or _doanes(simdata,
                                         len(simdata))
    elif bins == 'sqrt':
        bins = uniquevals * (uniquevals <= 25) or _sqrt_choice(len(simdata))
    elif isinstance(bins, int):
        bins = bins
    else:
        raise ValueError('Invalid bins argument in gof_plot')

    # Generate histogram
    hist(simdata, bins)

    # Plot options
    xlabel(name or 'Value', fontsize='x-small')

    ylabel("Frequency", fontsize='x-small')

    # Smaller tick labels
    tlabels = gca().get_xticklabels()
    setp(tlabels, 'fontsize', fontmap[1])
    tlabels = gca().get_yticklabels()
    setp(tlabels, 'fontsize', fontmap[1])

    # Plot vertical line at location of true data value
    axvline(x=trueval, linewidth=2, color='r', linestyle='dotted')

    if not os.path.exists(path):
        os.mkdir(path)
    if not path.endswith('/'):
        path += '/'
    # Save to file
    savefig("%s%s%s.%s" % (path, name or 'MCMC', suffix, format))