Pyplot library gives us numerous functions, which can be used to customise charts such as adding titles or legends.
Some of the customisation options are listed in Table :
List of Pyplot functions to customise plots
Program: Plotting a line chart of date versus temperature by adding Label on X and Y axis, and adding a Title and Grids to the chart.
import matplotlib.pyplot as plt
date=["25/12","26/12","27/12"]
temp=[8.5,10.5,6.8]
plt.plot(date, temp) plt.xlabel("Date") #add the Label on x-axis
plt.ylabel("Temperature") #add the Label on y-axis
plt.title("Date wise Temperature") #add the title to the chart
plt.grid(True) #add gridlines to the background
plt.yticks(temp)
plt.show()
Line chart as output of Program
In the above example, we have used the xlabel, ylabel, title and yticks functions. We can see that compared to Figure table , the Figure line chart conveys more meaning, easily. We will learn about customisation of other plots in later sections.