import matplotlib.pyplot as plt

def plot_noise_specs(wire_specs, pdffile, planes=None, fontsize=10):
    '''
    
    '''
    from matplotlib.backends.backend_pdf import PdfPages

    with PdfPages(pdffile) as pdf:
        fig = plt.figure()
        for i, wire_spec in enumerate(wire_specs) :
            if planes is not None and wire_spec['plane'] not in planes:
                continue
            label = "plane {:d} wirelen {:.2f}".format(wire_spec['plane'], wire_spec['wirelen'])
            plt.plot(wire_spec['freqs'],wire_spec['amps'],label=label)
        plt.legend(loc='best', fontsize=10)
        plt.grid()
        plt.xlabel("frec", fontsize=fontsize)
        plt.ylabel("amp", fontsize=fontsize)
        plt.yticks(fontsize=fontsize)
        plt.xticks(fontsize=fontsize)
        pdf.savefig(fig)
        plt.close()