-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscatter-plots.py
More file actions
56 lines (31 loc) · 890 Bytes
/
Copy pathscatter-plots.py
File metadata and controls
56 lines (31 loc) · 890 Bytes
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
from matplotlib import pyplot as plt
import pandas as pd
import numpy as np
plt.style.use('fivethirtyeight')
#x axis
x=[1,4,6,63,7,9,6]
#y axis
y=[2,5,8,2,9,6,4]
#size array for plotted points
sizes=[455,234,677,234,888,324]
#color array with intensity of color
colors=[9,4,3,6,2,5,8]
#alpha -> transparency
plt.scatter(x,y,s=sizes,c=colors,cmap='Greens',linewidths=2,alpha=0.75,edgecolors='black')
cbar=plt.colorbar()
cbar.set_label('popularity')
plt.show()
data=pd.read_csv('2019-05-31-data.csv')
views=data['view_count']
likes=data['likes']
ratio=data['ratio']
#size of figure width,height
plt.figure(figsize=(20,5))
plt.scatter(views,likes,s=ratio,c=ratio,cmap='summer',edgecolors='black',linewidths=1,alpha=0.7)
cbar=plt.colorbar()
cbar.set_label('like /dislike ration')
#scaling to log
plt.xscale('log')
plt.yscale('log')
plt.savefig('scat.png')
plt.show()