Creating Line Charts


from matplotlib import pyplot as plt
months=[1,2,3]
income1=[2000,5000,25000]
income2=[4000,8000,16000]
plt.plot(months,income1, marker="o", color="r")
plt.plot(months,income2, marker="o",color="black")
plt.title("Income of company ArdousGeek and CannyJock")
plt.xlabel("Months")
plt.ylabel("Income")
plt.legend(["ArdousGeek","CannyJock"])
plt.grid()
plt.show()
Creating Bar Charts
days=[1,2,3,4,5,6,7]
day_temp=[25,30,34,27,23,27,31]
night_temp=[20,20,24,22,22,25,19]
plt.bar(days, day_temp, color="brown")
plt.bar(days, night_temp, color="black")
plt.title("temperature record of the last week")
plt.xlabel("days")
plt.ylabel("temperature (c)")
plt.legend(["days","night"])
plt.show()
Creating Pie Charts
continents=["North america","South America","Europe","Asia","Africa"]
population=[250000, 500000, 750000, 1000000, 1250000, 1500000]
plt.pie(population, autopct="%1.1f%%", startangle=45)
plt.legend(continents)
plt.axis("equal")
plt.show()