Python Data Visualization | Matplotlib | Seaborn | Plotly: Matplotlib Line Chart

Поделиться
HTML-код
  • Опубликовано: 16 ноя 2024

Комментарии • 2

  • @sharathbs9910
    @sharathbs9910 Год назад

    Please teach me data label enable with plot chart

    • @AbhisheakSaraswat
      @AbhisheakSaraswat Год назад

      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.