def scale_y_universal(average=[1,10], axes="current"):
    """

    This function scales lines vertically.

    average=[1,10]    indices of average universal point

    """

    if axes=="current": axes = _pylab.gca()

    # get the lines from the plot
    lines = axes.get_lines()

    # loop over the lines and trim the data
    for m in range(0,len(lines)):
        if isinstance(lines[m], _mpl.lines.Line2D):

            # get the actual data values
            xdata = lines[m].get_xdata()
            ydata = lines[m].get_ydata()

            # figure out the scaling factor
            s=0
            for n in range(average[0], average[1]+1): s += ydata[n]
            scale = 1.0*s/(average[1]-average[0]+1.0)

            # loop over the ydata to scale it
            for n in range(0,len(ydata)): ydata[n] = ydata[n]/scale

            # update the data for this line
            lines[m].set_data(xdata, ydata)

    # update the title
    title = axes.title.get_text()
    title += ", universal scale"
    axes.title.set_text(title)

    # zoom to surround the data properly
    auto_zoom()
def scale_y_universal ( average = [ 1 , 10 ] , axes = "current" ) : if axes == "current" : axes = _pylab . gca ( ) lines = axes . get_lines ( ) for m in range ( 0 , len ( lines ) ) : if isinstance ( lines [ m ] , _mpl . lines . Line2D ) : xdata = lines [ m ] . get_xdata ( ) ydata = lines [ m ] . get_ydata ( ) s = 0 for n in range ( average [ 0 ] , average [ 1 ] + 1 ) : s += ydata [ n ] scale = 1.0 * s / ( average [ 1 ] - average [ 0 ] + 1.0 ) for n in range ( 0 , len ( ydata ) ) : ydata [ n ] = ydata [ n ] / scale lines [ m ] . set_data ( xdata , ydata ) title = axes . title . get_text ( ) title += ", universal scale" axes . title . set_text ( title ) auto_zoom ( )
This function scales lines vertically.

    average=[1,10]    indices of average universal point