-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtop_10_anti_vax_ratio.py
81 lines (69 loc) · 2.97 KB
/
top_10_anti_vax_ratio.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import pandas as pd
import matplotlib.pyplot as plt
import argparse
import numpy as np
def stacked_bar_chart_wayback(data_chart):
plt.barh(data_chart['account name'],
width=data_chart['wayback loadable mementos'],
color='blue')
plt.barh(data_chart['account name'],
width=(data_chart[
'total number of wayback mementos between (2013 and mid 2019)']) -
(data_chart['wayback loadable mementos']),
left=data_chart['wayback loadable mementos'],
color='orange')
plt.xlabel('Number of Scrapable/Non-scrapable Mementos')
plt.ylabel('Account Names')
plt.legend(["Scrapable Mementos", "Non-scrapable Mementos"])
plt.title(
'Scrapable and Non-scrapable Wayback Machine Mementos for Health Authorities'
)
plt.tight_layout()
plt.show()
def stacked_bar_chart_archive(data_chart):
plt.barh(
data_chart['account name'],
width=data_chart['loadable archive_is mementos between 2019-2023'],
color='blue')
plt.barh(data_chart['account name'],
width=data_chart['total number of mementos archive.is'] -
data_chart['loadable archive_is mementos between 2019-2023'],
left=data_chart['loadable archive_is mementos between 2019-2023'],
color='orange')
plt.xlabel('Number of Scrapable/Non-scrapable Mementos')
plt.ylabel('Account Names')
plt.legend(["Scrapable Mementos", "Non-scrapable Mementos"])
plt.title(
'Scrapable and Non-scrapable Archive.today Mementos for Health Authorities'
)
plt.tight_layout()
plt.show()
def stacked_bar_chart_total(data_chart):
plt.barh(data_chart['account name'],
width=data_chart['Total Loadable Mementos'],
color='b')
plt.barh(data_chart['account name'],
width=data_chart['Total Mementos'] -
data_chart['Total Loadable Mementos'],
left=data_chart['Total Loadable Mementos'],
color='orange')
plt.xlabel('Number of Scrapable/Non-scrapable Mementos')
plt.ylabel('Account Names')
plt.legend(["Scrapable Mementos", "Non-scrapable Mementos"])
plt.title('Scrapable and Non-scrapable Mementos for Top 10 Anti-vaxxers')
plt.tight_layout()
plt.show()
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("csv_file")
args = parser.parse_args()
account_data_df = df = pd.read_csv(args.csv_file)
'''
bar_chart_mem_avail(account_data_df)
bar_chart_mem_ratio(account_data_df)
bar_chart_archive_is(account_data_df)
bar_chart_wayback(account_data_df)
'''
stacked_bar_chart_wayback(account_data_df.sort_values('total number of wayback mementos between (2013 and mid 2019)', ascending=False))
stacked_bar_chart_archive(account_data_df.sort_values('total number of mementos archive.is', ascending=False))
stacked_bar_chart_total(account_data_df.sort_values('Total Mementos', ascending=False))