(lasts, paths=[], widths=[])
return f
paths: list of path0~path2
paths: list of path0~path2
paths : list of path0~path2
def plot_path_width(lasts, paths=[], widths=[]):
    '''
    paths: list of path0~path2
    '''
    assert len(paths) > 0 and len(widths) > 0
    path0 = paths[0]
    path1 = paths[1] if len(paths) > 1 else []
    path2 = paths[2] if len(paths) > 2 else []
    width0 = widths[0]
    width1 = widths[1] if len(widths) > 1 else []
    width2 = widths[2] if len(widths) > 2 else []

    # just for visualization purpose
    if path0[-1] != lasts[0]: path0.append(lasts[0])
    if len(path1) != 0 and path1[-1] != lasts[1]: path1.append(lasts[1])
    if len(path2) != 0 and path2[-1] != lasts[2]: path2.append(lasts[2])
    line_updown = -0.07
    annotation_updown = 0.05; annotation_down_scale = 1.7
    x_len = max(len(path0), len(path1), len(path2))
    f, ax = plt.subplots(figsize=(x_len, 3))
    
    assert len(path0) == len(width0) + 1 or len(path0) + len(width0) == 0, "path0 %d, width0 %d"%(len(path0), len(width0))
    assert len(path1) == len(width1) + 1 or len(path1) + len(width1) == 0, "path1 %d, width1 %d"%(len(path1), len(width1))
    assert len(path2) == len(width2) + 1 or len(path2) + len(width2) == 0, "path2 %d, width2 %d"%(len(path2), len(width2))
    
    ax.plot(np.arange(len(path0)), 2 - np.array(path0), label='1/32', lw=2.5, color='#000000', linestyle='-')
    ax.plot(np.arange(len(path1)), 2 - np.array(path1) + line_updown, lw=1.8, label='1/16', color='#313131', linestyle='--')
    ax.plot(np.arange(len(path2)), 2 - np.array(path2) + line_updown*2, lw=1.2, label='1/8', color='#5a5858', linestyle='-.')
    
    annotations = {} # (idx, scale, width, down): ((x, y), width)
    for idx, width in enumerate(width2):
        annotations[(idx, path2[idx], width, path2[idx+1]-path2[idx])] = ((0.35 + idx, 2 - path2[idx] + line_updown*2 + annotation_updown - (path2[idx+1]-path2[idx])/annotation_down_scale), width)
    for idx, width in enumerate(width1):
        annotations[(idx, path1[idx], width, path1[idx+1]-path1[idx])] = ((0.35 + idx, 2 - path1[idx] + line_updown + annotation_updown - (path1[idx+1]-path1[idx])/annotation_down_scale), width)
    for idx, width in enumerate(width0):
        annotations[(idx, path0[idx], width, path0[idx+1]-path0[idx])] = ((0.35 + idx, 2 - path0[idx] + annotation_updown - (path0[idx+1]-path0[idx])/annotation_down_scale), width)
    for k, v in annotations.items():
        plt.annotate("%.2f"%v[1], v[0], fontsize=12, color='red')
    
    plt.xticks(np.arange(x_len), list(range(1, x_len+1)))
    plt.yticks(np.array([0, 1, 2]), ["1/32", "1/16", "1/8"])
    plt.ylim([-0.4, 2.5])
    plt.ylabel("Scale", fontsize=17)
    plt.xlabel("Layer", fontsize=17)
    for tick in ax.xaxis.get_major_ticks():
        tick.label.set_fontsize(14)
    for tick in ax.yaxis.get_major_ticks():
        tick.label.set_fontsize(14)
    f.tight_layout()
    plt.legend(prop={'size': 14}, loc=3)
    return f
def plot_path_width ( lasts , paths = [ ] , widths = [ ] ) : assert len ( paths ) > 0 and len ( widths ) > 0 path0 = paths [ 0 ] path1 = paths [ 1 ] if len ( paths ) > 1 else [ ] path2 = paths [ 2 ] if len ( paths ) > 2 else [ ] width0 = widths [ 0 ] width1 = widths [ 1 ] if len ( widths ) > 1 else [ ] width2 = widths [ 2 ] if len ( widths ) > 2 else [ ] # just for visualization purpose if path0 [ - 1 ] != lasts [ 0 ] : path0 . append ( lasts [ 0 ] ) if len ( path1 ) != 0 and path1 [ - 1 ] != lasts [ 1 ] : path1 . append ( lasts [ 1 ] ) if len ( path2 ) != 0 and path2 [ - 1 ] != lasts [ 2 ] : path2 . append ( lasts [ 2 ] ) line_updown = - 0.07 annotation_updown = 0.05 annotation_down_scale = 1.7 x_len = max ( len ( path0 ) , len ( path1 ) , len ( path2 ) ) f , ax = plt . subplots ( figsize = ( x_len , 3 ) ) assert len ( path0 ) == len ( width0 ) + 1 or len ( path0 ) + len ( width0 ) == 0 , "path0 %d, width0 %d" % ( len ( path0 ) , len ( width0 ) ) assert len ( path1 ) == len ( width1 ) + 1 or len ( path1 ) + len ( width1 ) == 0 , "path1 %d, width1 %d" % ( len ( path1 ) , len ( width1 ) ) assert len ( path2 ) == len ( width2 ) + 1 or len ( path2 ) + len ( width2 ) == 0 , "path2 %d, width2 %d" % ( len ( path2 ) , len ( width2 ) ) ax . plot ( np . arange ( len ( path0 ) ) , 2 - np . array ( path0 ) , label = '1/32' , lw = 2.5 , color = '#000000' , linestyle = '-' ) ax . plot ( np . arange ( len ( path1 ) ) , 2 - np . array ( path1 ) + line_updown , lw = 1.8 , label = '1/16' , color = '#313131' , linestyle = '--' ) ax . plot ( np . arange ( len ( path2 ) ) , 2 - np . array ( path2 ) + line_updown * 2 , lw = 1.2 , label = '1/8' , color = '#5a5858' , linestyle = '-.' ) annotations = { } # (idx, scale, width, down): ((x, y), width) for idx , width in enumerate ( width2 ) : annotations [ ( idx , path2 [ idx ] , width , path2 [ idx + 1 ] - path2 [ idx ] ) ] = ( ( 0.35 + idx , 2 - path2 [ idx ] + line_updown * 2 + annotation_updown - ( path2 [ idx + 1 ] - path2 [ idx ] ) / annotation_down_scale ) , width ) for idx , width in enumerate ( width1 ) : annotations [ ( idx , path1 [ idx ] , width , path1 [ idx + 1 ] - path1 [ idx ] ) ] = ( ( 0.35 + idx , 2 - path1 [ idx ] + line_updown + annotation_updown - ( path1 [ idx + 1 ] - path1 [ idx ] ) / annotation_down_scale ) , width ) for idx , width in enumerate ( width0 ) : annotations [ ( idx , path0 [ idx ] , width , path0 [ idx + 1 ] - path0 [ idx ] ) ] = ( ( 0.35 + idx , 2 - path0 [ idx ] + annotation_updown - ( path0 [ idx + 1 ] - path0 [ idx ] ) / annotation_down_scale ) , width ) for k , v in annotations . items ( ) : plt . annotate ( "%.2f" % v [ 1 ] , v [ 0 ] , fontsize = 12 , color = 'red' ) plt . xticks ( np . arange ( x_len ) , list ( range ( 1 , x_len + 1 ) ) ) plt . yticks ( np . array ( [ 0 , 1 , 2 ] ) , [ "1/32" , "1/16" , "1/8" ] ) plt . ylim ( [ - 0.4 , 2.5 ] ) plt . ylabel ( "Scale" , fontsize = 17 ) plt . xlabel ( "Layer" , fontsize = 17 ) for tick in ax . xaxis . get_major_ticks ( ) : tick . label . set_fontsize ( 14 ) for tick in ax . yaxis . get_major_ticks ( ) : tick . label . set_fontsize ( 14 ) f . tight_layout ( ) plt . legend ( prop = { 'size' : 14 } , loc = 3 ) return f