Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import OrderedDict
- import matplotlib.pyplot as plt
- deps = {'3': 30, '4': 129, '1': 91, '2': 205, '5': 142}
- courses = {'3': 125, '4': 103, '1': 206, '1M': 13, '5': 12, '2M': 23, '2': 152}
- groups = Counter({'474': 17, '276': 14, '475': 13, '265': 13, '278': 11, '174': 11, '571': 11, '144': 11, '173': 10, '574': 10, '446': 10, '277': 10, '461': 10, '554': 9, '253': 9, '243': 9, '273': 8, '465': 8, '469м': 8, '476': 8, '175': 8, '264': 7, '551': 7, '464': 7, '254': 7, '363': 7, '552': 7, '251': 7, '270': 6, '550': 6, '546': 6, '272': 6, '454': 6, '572': 6, '165': 6, '263': 6, '444': 5, '255': 5, '576': 5, '172': 5, '471': 5, '252': 5, '553': 5, '563': 5, '462': 5, '560': 5, '274': 5, '361': 5, '152': 4, '573': 4, '564': 4, '268': 4, '244': 4, '242': 4, '555': 4, '271м': 4, '5364': 4, '141': 4, '249': 4, '455': 4, '2566': 4, '532': 4, '472': 4, '441': 4, '545': 4, '452': 4, '2548': 4, '561': 4, '267': 4, '163': 4, '445': 3, '267м': 3, '266': 3, '171': 3, '543': 3, '570': 3, '161': 3, '544': 3, '565': 3, '351': 3, '246': 3, '261': 3, '143': 3, '247': 3, '245': 3, '456': 3, '154': 3, '562': 3, '258': 3, '266м': 2, '575': 2, '262': 2, '164': 2, '541': 2, '372': 2, '275': 2, '241': 2, '371': 2, '248': 2, '342': 2, '257': 2, '153': 2, '256': 2, '142': 2, '558': 2, '568': 2, '271': 2, '151': 2, '531(хтвмс)': 2, '362': 2, '540': 2, '1612м': 1, '4711м': 1, '145': 1, '179м(хнимэт)': 1, '178м': 1, '4710м': 1, '375м': 1, '374м': 1, '167м': 1, '442': 1, '542': 1, '272м': 1, '2547': 1, '367м': 1, '466': 1, '268м': 1, '162': 1, '043221': 1, '341': 1, '355': 1, '264м': 1, '261м': 1, '2556': 1, '352': 1, '179м(тэп)': 1, '467м': 1, '263м': 1, '373м': 1, '533': 1, '530': 1, '569м': 1, '559': 1, '2557': 1, '166м': 1})
- most_common_groups = {k: v for k, v in groups.most_common(20)}
- notifications = {'Не подписан': 410, '20:00': 49, '21:00': 38, '8:00': 31, '22:00': 28, '7:30': 19, '7:00': 16, '23:00': 9}
- f = plt.figure(1)
- f.set_figheight(16)
- f.set_figwidth(20)
- plt.style.use('ggplot')
- def bar_plot(d, title):
- data = OrderedDict(sorted(d.items(), key=lambda x: -x[1]))
- y = range(len(data))
- bars = data.values()
- plt.bar(y, bars, align='center', alpha=0.5)
- plt.xticks(y, data.keys())
- plt.ylabel('пользователи')
- plt.title(title)
- plt.subplot(221)
- bar_plot(deps, 'Распределение по факультетам')
- plt.subplot(222)
- bar_plot(courses, 'Распределение по курсам')
- plt.subplot(223)
- bar_plot(most_common_groups, 'Распределение по группам')
- plt.subplot(224)
- bar_plot(notifications, 'Подписки на уведомления')
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement