5.Plot the following data on a line chart and customize the chart according to the below-given instructions:
5.Plot the following data on a line chart and customize the chart according to the below-given instructions:
Write a title for the chart “The Monthly Sales Report“
Write the appropriate titles of both the axes
Write code to Display legends
Display blue color for the line
Use the line style – dashed
Display diamond style markers on data points
Solution :-
import matplotlib.pyplot as pp
mon =['January','February','March','April','May']
sales = [510,350,475,580,600]
pp.plot(mon,sales,label='Sales',color='b',linestyle='dashed',marker='D')
pp.title("The Monthly Sales Report")
pp.xlabel("Months")
pp.ylabel("Sales")
pp.legend()
pp.show()