Project Twitch Matplotlib Visualization

 import codecademylib3_seaborn

from matplotlib import pyplot as plt
import numpy as np
import pandas as pd

# Bar Graph: Featured Games


games = ["LoL""Dota 2""CS:GO""DayZ""HOS""Isaac""Shows""Hearth""WoT""Agar.io"]

viewers =  [1070472302239210171170908671]
#plt.bar(range(len(games)),viewers,color='pink')
plt.title('Viewers Per Game')
plt.xlabel('Game')
plt.ylabel('No of Viewers')
ax = plt.subplot()
ax.set_xticks([0,1,2,3,4,5,6,7,8,9,10])
ax.set_xticklabels(gamesrotation=30)
#plt.show()

# Pie Chart: League of Legends Viewers' Whereabouts


labels = ["US""DE""CA""N/A""GB""TR""BR""DK""PL""BE""NL""Others"]

countries = [44766644945282520191717279]
colors = ['lightskyblue''gold''lightcoral''gainsboro''royalblue''lightpink''darkseagreen''sienna''khaki''gold''violet''yellowgreen']
explode = (0.100000000000)
#plt.pie(countries,colors = colors, shadow=True, startangle=345, autopct='%1.0f%%', pctdistance=1.15)
plt.title("League of Legends Viewers' Whereabouts")
plt.legend(labelsloc="right")
#plt.show()

# Line Graph: Time Series Analysis

hour = range(24)

viewers_hour = [301734291914324954862584051695576811021207163]

plt.plot(hour,viewers_hour)
plt.title('Viewers Per Hour')
plt.legend(['2015-01-01'])

plt.xlabel("Hour")
plt.ylabel("Viewers")

ax = plt.subplot()

ax.set_xticks(hour)
ax.set_yticks([020406080100120])
y_upper = [i + (i*0.15for i in viewers_hour]
y_lower = [i - (i*0.15for i in viewers_hour]
plt.fill_between(houry_lowery_upperalpha=0.2)
plt.show()


Comments

Popular posts from this blog

Binomial Test in Python

Slicing and Indexing in Python Pandas

Python Syntax and Functions Part2 (Summary Statistics)