Limes Sales Graph using Matplotlip
from matplotlib import pyplot as plt
months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
visits_per_month = [9695, 7909, 10831, 12942, 12495, 16794, 14161, 12762, 12777, 12439, 10309, 8724]
# numbers of limes of different species sold each month
key_limes_per_month = [92.0, 109.0, 124.0, 70.0, 101.0, 79.0, 106.0, 101.0, 103.0, 90.0, 102.0, 106.0]
persian_limes_per_month = [67.0, 51.0, 57.0, 54.0, 83.0, 90.0, 52.0, 63.0, 51.0, 44.0, 64.0, 78.0]
blood_limes_per_month = [75.0, 75.0, 76.0, 71.0, 74.0, 77.0, 69.0, 80.0, 63.0, 69.0, 73.0, 82.0]
# create your figure here
plt.figure(figsize=(12,8))
ax1 = plt.subplot(1,2,1)
x_value = range(len(months))
plt.plot(x_value,visits_per_month,marker = 's')
plt.xlabel('month')
plt.ylabel('visitors')
ax1.set_xticks(x_value)
ax1.set_xticklabels(months)
plt.title('Number of Visitors Per Month')
ax2 = plt.subplot(1,2,2)
plt.plot(x_value,key_limes_per_month,color = 'pink')
plt.plot(x_value,persian_limes_per_month,color = 'green')
plt.plot(x_value,blood_limes_per_month,color = 'red')
plt.legend(['Key Limes','Persian Limes','Blood Limes'])
ax2.set_xticks(x_value)
ax2.set_xticklabels(months)
plt.title('Sales Per Product')
plt.show()
plt.savefig('Lime Sales Graph')
games = ["LoL", "Dota 2", "CS:GO", "DayZ", "HOS", "Isaac", "Shows", "Hearth", "WoT", "Agar.io"]
viewers = [1070, 472, 302, 239, 210, 171, 170, 90, 86, 71]
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(games, rotation=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 = [447, 66, 64, 49, 45, 28, 25, 20, 19, 17, 17, 279]
# Line Graph: Time Series Analysis
hour = range(24)
viewers_hour = [30, 17, 34, 29, 19, 14, 3, 2, 4, 9, 5, 48, 62, 58, 40, 51, 69, 55, 76, 81, 102, 120, 71, 63]
Comments
Post a Comment