def plot(x,y,wanted_list,groups): #print(x[0:5]) #one graph for each group font = {'size': 13} plt.rc('font', **font) stevec = 0 for g in groups: #if len(g) == 1: plt.plot(x, y[a]) #else: for a in g: #plt.plot(x,y[a], label=wanted_list[a]) yy = [1000000 * m for m in Smoothing.smoothTriangle(y[a],3)] el = yy[0] yy = [el,el,el] + yy[:-3] #yy = yy[3:-3] #word = wanted_list[a][0].title() + ' ' + wanted_list[a][1].title() word = wanted_list[a].title() #if word == 'Dicaprio': word ='DiCaprio' #if wanted_list[a][1]=='hiv': word = 'Virus HIV' #plt.plot(x,yy,label=wanted_list[a].title()) yy = yy[6:-10] xx = x[6:-10] print('lenx',len(x),'len y',len(yy)) plt.plot(xx,yy,label = word) #plt.legend(bbox_to_anchor=(1, 1), loc=0, borderaxespad=1.) plt.legend(loc=1) if stevec==0: plt.text(datetime.datetime(2004, 8, 13, 0, 0), 0, ' |', fontsize=15,weight='heavy') plt.text(datetime.datetime(2004, 8, 13, 0, 0), -110, 'OI Atene',horizontalalignment='center', bbox=dict(facecolor='blue', alpha=0.1),size=23,style='italic',weight='light') plt.text(datetime.datetime(2000, 9, 15, 0, 0), 0, ' |', fontsize=15,weight='heavy') plt.text(datetime.datetime(2000, 9, 15, 0, 0), -110, 'OI Sydney',horizontalalignment='center', bbox=dict(facecolor='blue', alpha=0.1),size=23,style='italic',weight='light') plt.text(datetime.datetime(1998, 2, 7, 0, 0), 0, ' |', fontsize=15,weight='heavy') plt.text(datetime.datetime(1998, 2, 7, 0, 0), -110, 'OI Nagano',horizontalalignment='center', bbox=dict(facecolor='blue', alpha=0.1),size=23,style='italic',weight='light') plt.text(datetime.datetime(2006, 2, 10, 0, 0), 0, ' |', fontsize=15,weight='heavy') plt.text(datetime.datetime(2006, 2, 10, 0, 0), -110, 'OI Torino',horizontalalignment='center', bbox=dict(facecolor='blue', alpha=0.1),size=23,style='italic',weight='light') plt.text(datetime.datetime(2002, 2, 8, 0, 0), 0, ' |', fontsize=15,weight='heavy') plt.text(datetime.datetime(2002, 2, 8, 0, 0), -110, 'OI Salt Lake City',horizontalalignment='center', bbox=dict(facecolor='blue', alpha=0.1),size=23,style='italic',weight='light') plt.xlabel('Leto',labelpad=70) elif stevec==1: plt.text(datetime.datetime(2001, 1, 20, 0, 0), 0, ' |', fontsize=15,weight='heavy') plt.text(datetime.datetime(2001, 1, 20, 0, 0), -80, 'Izvolitev Busha',horizontalalignment='center', bbox=dict(facecolor='blue', alpha=0.1),size=23,style='italic',weight='light') plt.xlabel('Leto',labelpad=80) elif stevec==3: plt.text(datetime.datetime(2003, 3, 20, 0, 0), 0, ' |', fontsize=15,weight='heavy') plt.text(datetime.datetime(2003, 3, 20, 0, 0), -310, 'Invazija na Irak',horizontalalignment='center', bbox=dict(facecolor='blue', alpha=0.1),size=23,style='italic',weight='light') plt.text(datetime.datetime(2001, 10, 7, 0, 0), 0, ' |', fontsize=15,weight='heavy') plt.text(datetime.datetime(2001, 10, 7, 0, 0), -310, 'Invazija na Afganistan',horizontalalignment='center', bbox=dict(facecolor='blue', alpha=0.1),size=23,style='italic',weight='light') plt.xlabel('Leto',labelpad=100) elif stevec==20: plt.text(datetime.datetime(2001, 11, 23, 0, 0), 0, ' |', fontsize=15,weight='heavy') plt.text(datetime.datetime(2001, 11, 23, 0, 0), -75, 'Primer BSE v SLO',horizontalalignment='center', bbox=dict(facecolor='blue', alpha=0.1),size=23,style='italic',weight='light') plt.text(datetime.datetime(2006, 2, 12, 0, 0), 0, ' |', fontsize=15,weight='heavy') plt.text(datetime.datetime(2006, 2, 12, 0, 0), -75, 'Primer ptičje gripe v SLO ',horizontalalignment='right', bbox=dict(facecolor='blue', alpha=0.1),size=23,style='italic',weight='light') plt.xlabel('Leto',labelpad=75) elif stevec==6: plt.text(datetime.datetime(2001, 9, 11, 0, 0), 0, ' |', fontsize=15,weight='heavy') plt.text(datetime.datetime(2001, 9, 11, 0, 0), -110, '11. september',horizontalalignment='center', bbox=dict(facecolor='blue', alpha=0.1),size=23,style='italic',weight='light') plt.text(datetime.datetime(2004, 9, 3, 0, 0), 0, ' |', fontsize=15,weight='heavy') plt.text(datetime.datetime(2004, 9, 3, 0, 0), -145, 'Beslan',horizontalalignment='center', bbox=dict(facecolor='blue', alpha=0.1),size=23,style='italic',weight='light') plt.text(datetime.datetime(2004, 3, 11, 0, 0), 0, ' |', fontsize=15,weight='heavy') plt.text(datetime.datetime(2004, 3, 11, 0, 0), -110, 'Madrid',horizontalalignment='center', bbox=dict(facecolor='blue', alpha=0.1),size=23,style='italic',weight='light') plt.text(datetime.datetime(2005, 7, 7, 0, 0), 0, ' |', fontsize=15,weight='heavy') plt.text(datetime.datetime(2005, 7, 7, 0, 0), -110, 'London',horizontalalignment='center', bbox=dict(facecolor='blue', alpha=0.1),size=23,style='italic',weight='light') plt.text(datetime.datetime(2002, 10, 23, 0, 0), 0, ' |', fontsize=15,weight='heavy') plt.text(datetime.datetime(2002, 10, 23, 0, 0), -145, 'Moskva',horizontalalignment='left', bbox=dict(facecolor='blue', alpha=0.1),size=23,style='italic',weight='light') plt.text(datetime.datetime(2002, 10, 12, 0, 0), 0, ' |', fontsize=15,weight='heavy') plt.text(datetime.datetime(2002, 10, 12, 0, 0), -110, 'Bali',horizontalalignment='right', bbox=dict(facecolor='blue', alpha=0.1),size=23,style='italic',weight='light') plt.text(datetime.datetime(1998, 8, 7, 0, 0), 0, ' |', fontsize=15,weight='heavy') plt.text(datetime.datetime(1998, 8, 7, 0, 0), -110, 'Tanzanija',horizontalalignment='center', bbox=dict(facecolor='blue', alpha=0.1),size=23,style='italic',weight='light') plt.xlabel('Leto',labelpad=130) else: plt.xlabel('Leto',labelpad=0) #if stevec==4: plt.legend(loc=2) #else: plt.legend(loc=1) stevec+=1 plt.gcf().autofmt_xdate() plt.ylabel('Število pojavitev na milijon besed',labelpad=50) #plt.xlabel('Leto',labelpad=20) plt.show()