Hi Please find the below solution to add the data labels on the chart using Python matplotlib. import matplotlib.pyplot as plt lst = [90, 80, 60, 70] marks = ["Python", "Pandas", "Math", "Science"] plt.bar(marks, lst) # adding data labels for x, y in zip(marks,lst): plt.text(x, y, str(y), ha='center', va='bottom') plt.xlabel('Subjects') plt.ylabel('Marks') plt.title('Marks in Different Subjects') plt.show() Let me know if you are facing any difficulties.
Please teach me data label enable with plot chart
Hi
Please find the below solution to add the data labels on the chart using Python matplotlib.
import matplotlib.pyplot as plt
lst = [90, 80, 60, 70]
marks = ["Python", "Pandas", "Math", "Science"]
plt.bar(marks, lst)
# adding data labels
for x, y in zip(marks,lst):
plt.text(x, y, str(y), ha='center', va='bottom')
plt.xlabel('Subjects')
plt.ylabel('Marks')
plt.title('Marks in Different Subjects')
plt.show()
Let me know if you are facing any difficulties.