Exemplo n.º 1
0
    def country_row_with_column_normalisation(C, countries):
        def all_countries_degree_list(countries, year, degree_function):
            return [degree_function(data, year, C, definition, def_args) for C in countries]

        return flatten([[normalize(positive_edge_count(data, year, C, definition, def_args),
                                   all_countries_degree_list(countries, year, positive_edge_count)),
                         normalize(negative_edge_count(data, year, C, definition, def_args),
                                   all_countries_degree_list(countries, year, negative_edge_count))] for year in years])
def print_degree_sum_over_time(args, other_args, this, other):
    print "x=%s;" % str([year for year in data.all_years]).replace(",", " ")
    for A in data.countries():
        print "degreecount=%s;" % str([degree_count(data, year, A, definition, args) for year in data.all_years]).replace(",", " ")
        print "degreesum1=%s;" % str([degree_sum(data, year, A, definition, args) for year in data.all_years]).replace(",", " ")
        print "positivecount1=%s;" % str([positive_edge_count(data, year, A, definition, args) for year in data.all_years]).replace(",", " ")
        print "negativecount1=%s;" % str([negative_edge_count(data, year, A, definition, args) for year in data.all_years]).replace(",", " ")
        print "degreesum2=%s;" % str([degree_sum(data, year, A, definition, other_args) for year in data.all_years]).replace(",", " ")
        print "plot(x,degreesum1,'b-o',x,degreesum2,'b-*',x,degreecount,'m-o',x,positivecount1,'g-o',x,negativecount1,'r-o');"
        print "hline = refline([0 0]);"
        print "set(hline,'Color','b');"
        print "legend('degree-sum1(T2=%d)','degree-sum2(T2=%d)','degree-count','positivecount1','negativecount1','Location','Best')" %(this,other)
        print "saveas(gcf,'%s-%d','png');" % (file_safe(A),this)