English

How can we make the bar chart of the figure horizontal?

Advertisements
Advertisements

Question

How can we make the bar chart of the figure horizontal?

Very Short Answer
Advertisements

Solution

  • Change the function: Replace plt.bar() with plt.barh() in your code.
  • Swap the labels: Change plt.xlabel("Day") to plt.ylabel("Day") and change plt.ylabel("Sales in Rs") to plt.xlabel("Sales in Rs").
shaalaa.com
  Is there an error in this question or solution?
Chapter 4: Plotting Data using Matplotlib - Intext Questions [Page 119]

APPEARS IN

NCERT Informatics Practices [English] Class 12
Chapter 4 Plotting Data using Matplotlib
Intext Questions | Q 3. | Page 119
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×