python_data_scien/algorithmic_thinking1/application2.py
def legend_example(p,m,node,comput_res_list,er_res_list,upa_res_list):
    """
    Plot an example with two curves with legends
    """
    xvals = [i for i in range(0,node+1)]

    plt.plot(xvals, comput_res_list, '-b', label='computer network graph')
    plt.plot(xvals, er_res_list, '-r', label='er graph(p:%s)' % str(p))
    plt.plot(xvals, upa_res_list, '-y', label='upa graph(m:%s)' % str(m))
    plt.legend(loc='upper right')
    plt.xlabel('removed node num')
    plt.ylabel('largest cc size')
    plt.title('compute_resilience')
    plt.grid(True)
    plt.show()

    Plot an example with two curves with legends
    
Plot an example with two curves with legends
Plot an example with two curves with legends
def legend_example(p,m,node,comput_res_list,er_res_list,upa_res_list):
    xvals = [i for i in range(0,node+1)]
    plt.plot(xvals, comput_res_list, '-b', label='computer network graph')
    plt.plot(xvals, er_res_list, '-r', label='er graph(p:%s)' % str(p))
    plt.plot(xvals, upa_res_list, '-y', label='upa graph(m:%s)' % str(m))
    plt.legend(loc='upper right')
    plt.xlabel('removed node num')
    plt.ylabel('largest cc size')
    plt.title('compute_resilience')
    plt.grid(True)
    plt.show()
def legend_example ( p , m , node , comput_res_list , er_res_list , upa_res_list ) : xvals = [ i for i in range ( 0 , node + 1 ) ] plt . plot ( xvals , comput_res_list , '-b' , label = 'computer network graph' ) plt . plot ( xvals , er_res_list , '-r' , label = 'er graph(p:%s)' % str ( p ) ) plt . plot ( xvals , upa_res_list , '-y' , label = 'upa graph(m:%s)' % str ( m ) ) plt . legend ( loc = 'upper right' ) plt . xlabel ( 'removed node num' ) plt . ylabel ( 'largest cc size' ) plt . title ( 'compute_resilience' ) plt . grid ( True ) plt . show ( )
Plot an example with two curves with legends
Plot an example with two curves with legends
"""
    Plot an example with two curves with legends
    """
p
m
node
comput_res_list
er_res_list
upa_res_list