matppotlib example:


In [1]:
import numpy as np
from matplotlib import pyplot as plt

ys = 200 + np.random.randn(100)
x = [x for x in range(len(ys))]

print(x)
print(ys)

plt.plot(x, ys, '-')
plt.fill_between(x, ys, 195, where=(ys > 195), facecolor='r', alpha=0.6)

plt.title("Data Visualization")
plt.show()


[0, 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, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]
[201.46378986 199.15752524 200.70393388 200.60297312 199.44429508
 201.07156849 200.00018254 199.7606207  199.40041133 200.12409022
 200.48139785 200.71925595 199.53914478 201.26947909 199.52655418
 201.02408375 200.39735179 198.23310307 198.86486343 198.8198493
 200.59689175 201.51130053 200.25164327 200.08595061 197.59771688
 199.3578842  199.49582382 200.06588887 200.38589266 199.6844342
 199.32199496 200.5414609  200.06900686 200.29326572 201.31663673
 200.87324254 200.62492861 199.04415237 200.75530748 200.99524704
 199.57744775 201.08861984 199.38370285 198.74288955 201.05595315
 199.37971947 199.63752519 198.75324493 201.27703072 198.40134108
 199.39968077 200.46487341 202.04555765 201.85866928 199.91737763
 199.91398261 198.56778769 198.74104328 198.85750574 200.59266505
 198.83763568 201.76358148 201.03540677 198.88718677 201.43241197
 200.70274822 200.5049622  199.47488253 198.8670939  200.30493361
 199.85083586 197.97032768 199.09862997 201.40022324 200.22361412
 199.20832502 198.4028224  200.35713932 200.89251406 200.34351618
 198.38898764 198.71984895 199.78364873 199.98742734 199.2995476
 198.35043721 198.72321032 199.70885998 199.50591301 199.92468453
 200.4750499  201.71081268 201.7473182  198.70704317 200.65139435
 198.89931476 198.65576606 198.68039454 201.75455414 199.61139734]
<Figure size 640x480 with 1 Axes>

In [16]:
data = np.genfromtxt('data/PewDiePie.csv', delimiter=',')
print(np.shape(data))
# print(data.dtypes)
print(len(data))
y = [data[i][1] for i in range(len(data))]
y10 = y[1:11]
print(y10)
plt.plot(range(10),y10)
plt.show()
plt.hist(y, bins=20, range=(0, 80000))
plt.title("Histogram")
plt.show()


(21, 2)
21
[71915.0, 48270.0, 47746.0, 42276.0, 36867.0, 28722.0, 29794.0, 33125.0, 27877.0, 30675.0]

In [ ]: