Advertisements
Advertisements
प्रश्न
Plot the following data using a line plot:
| Day | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| Tickets sold | 2000 | 2800 | 3000 | 2500 | 2300 | 2500 | 1000 |
- Before displaying the plot display “Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday” in place of Day 1, 2, 3, 4, 5, 6, 7
- Change the color of the line to ‘Magenta’.
कोड लेखन
Advertisements
उत्तर
import matplotlib.pyplot as plt
day = ['Monday', 'Tuesday', 'Wednesday', 'Thursday',
'Friday', 'Saturday', 'Sunday']
tickets = [2000, 2800, 3000, 2500, 2300, 2500, 1000]
plt.plot(day, tickets, color='magenta')
plt.title("Tickets Sold in a Week")
plt.xlabel("Days")
plt.ylabel("Number of Tickets Sold")
plt.show()
Output:
- Days (Monday to Sunday) on the X-axis
- Tickets sold on the Y-axis
- Line colour set to magenta.
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
