Changing the location of title with pad parameter
In this method, we will be using the pad argument of the title() function to change the title location in the given plot in the python programming language.
Syntax:
matplotlib.pyplot.title('Title', pad=value)
Example:
In this example, We will elevateTitleTitle by using the “pad” parameter. The offset of the Title from the top of the axes, in points. The default value is none.
Python3
#import matplotlib import matplotlib.pyplot as plt # Points to mark plt.plot([ 1 , 2 , 3 , 4 , 5 ], [ 1 , 4 , 6 , 14 , 25 ]) # X label plt.xlabel( 'X-axis' ) # Y label plt.ylabel( 'Y-axis' ) # Title with pad plt.title( 'Title' , pad = 50 ) |
Output:
How to Adjust Title Position in Matplotlib?
In this article, you learn how to modify the Title position in matplotlib in Python.