Practical  Bar Charts

Practical Bar Charts

import matplotlib.pyplot as plt

x = [1, 2, 3, 4, 5]

y = [6, 2, 1, 1.5, 9]

plt.bar(x, y, label="Bar 1")

plt.xlabel("Month")

plt.ylabel("Sales")

plt.title("Sales Per Month")

plt.legend()

plt.show()


Dual Bar Graph

import matplotlib.pyplot as plt

x = [1, 3, 5, 7, 10]

y = [6, 2, 1, 1.5, 9]

x2 = [2, 4, 4, 8, 9]

y2 = [3, 3, 6, 1, 6]

plt.bar(x, y, label="Store A")

plt.bar(x2, y2, label="Store B")

plt.xlabel("Month")

plt.ylabel("Sales")

plt.title("Sales Per Month Of Store A and B")

plt.legend()

plt.show()



Tiffany Teasley

Data Scientist | LinkedIn Top Voice | Founder of Data Sistah | Teacher Turned Data Scientist | AI Developer | Speaker | I help aspiring data scientists accelerate their careers and teach others how to build AI solutions

1 个月

Great share! Learning Matplotlib is a must in this field. I am a fan of Plotly for a more interactive experience.

回复

要查看或添加评论,请登录

Saif -ur- Rasul的更多文章

社区洞察

其他会员也浏览了