Matplotlib.pyplot.figtext() in Python Last Updated : 19 Apr, 2020 Comments Improve Suggest changes Like Article Like Report Matplotlib is an extensively used Python library for data visualization. It is a multi-platform data visualization library built on NumPy arrays, also designed to work with the SciPy stack. Matplotlib.pyplot.figtext() Figtext is used to add text to a figure at any location on it. You can even add the text outside the Axes. It uses the complete figure for co-ordinates, where bottom-left denotes (0, 0) and top right represents (1, 1). The centre of the figure is (0.5, 0.5). Syntax: matplotlib.pyplot.figtext(x, y, s, *args, **kwargs) Parameter Values Use x, y Float Position to place the text. It is by default in figure coordinates [0, 1] s String Text String Example #1: A sample example demonstrating the use of figtext. Python3 1== # importing required modules import matplotlib.pyplot as plt import numpy as np # values of x and y axes x = np.arange(0, 8, 0.1) y = np.sin(x) plt.plot(x, y) # pyplot.figtext(x, y, string) plt.figtext(0, 0, "This is a sample example \ explaining figtext", fontsize = 10) plt.xlabel('x') plt.ylabel('y') plt.show() The above example places text on the bottom left of the figure of the given font size. Example #2: We can also place text at a relative position in the figure by adjusting the values of x and y. Python3 1== # importing required modules import matplotlib.pyplot as plt import numpy as np # values of x and y axes x = np.arange(0, 8, 0.1) y = np.sin(x) plt.plot(x, y) plt.figtext(0.55, 0.7, "Sin curve", horizontalalignment ="center", verticalalignment ="center", wrap = True, fontsize = 14, color ="green") plt.xlabel('x') plt.ylabel('y') plt.show() Alignment arguments- horizontalalignment and verticalalignment place the text in the centre while the wrap argument makes sure that the text lies within the figure width. The color argument gives the font color. Example #3: We can also add a bounding box around the text by using the bbox argument. Python3 1== # importing required modules import matplotlib.pyplot as plt import numpy as np # values of x and y axes x = np.arange(0, 8, 0.1) y = np.exp(x) plt.plot(x, y) # pyplot.figtext(x, y, string) plt.figtext(0.55, 0.7, "Exponential Curve", horizontalalignment ="center", wrap = True, fontsize = 10, bbox ={'facecolor':'grey', 'alpha':0.3, 'pad':5}) plt.xlabel('x') plt.ylabel('y') plt.show() Example #4: We can also use *args and **kwargs to add text properties to our plot. *args and **kwargs are used to pass multiple arguments or keyword arguments to a function. Note: For more info refer to the article: *args and **kwargs in Python Python3 1== # importing required properties import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, 100, 501) y = np.sin(x) figtext_args = (0.5, 0, "figtext using args and kwargs") figtext_kwargs = dict(horizontalalignment ="center", fontsize = 14, color ="green", style ="italic", wrap = True) plt.plot(x, y) plt.figtext(*figtext_args, **figtext_kwargs) plt.show() Comment More infoAdvertise with us Next Article Matplotlib.pyplot.figtext() in Python H Hritika Rajput Follow Improve Article Tags : Python Write From Home Python-Library Python-matplotlib Practice Tags : python Similar Reads matplotlib.pyplot.figure() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, 2 min read Matplotlib.pyplot.get_fignums() in Python Matplotlib is a library in Python and it is numerical â mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, 2 min read Matplotlib.pyplot.gca() in Python Matplotlib is a library in Python and it is a numerical - mathematical extension for the NumPy library. Pyplot is a state-based interface to a Matplotlib module that provides a MATLAB-like interface.  matplotlib.pyplot.gca() Function The gca() function in pyplot module of matplotlib library is used 2 min read Matplotlib.pyplot.rc_context() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, 2 min read Matplotlib.pyplot.gci() in Python Matplotlib is a library in Python and it is numerical â mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, 2 min read Matplotlib.pyplot.get_figlabels() in Python Matplotlib is a library in Python and it is numerical â mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, 2 min read Matplotlib.pyplot.ginput() in Python Matplotlib is a library in Python and it is numerical â mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, 2 min read Matplotlib.pyplot.axes() in Python axes() method in Matplotlib is used to create a new Axes instance (i.e., a plot area) within a figure. This allows you to specify the location and size of the plot within the figure, providing more control over subplot layout compared to plt.subplot(). It's key features include:Creates a new Axes at 3 min read Matplotlib.pyplot.axis() in Python axis() function in Matplotlib is used to get or set properties of the x- and y-axis in a plot. It provides control over axis limits, aspect ratio and visibility, allowing customization of the plotâs coordinate system and view. It's key feature includes:Gets or sets the axis limits [xmin, xmax, ymin, 3 min read Matplotlib.pyplot.connect() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. matplotlib.pyplot.connect() Function This method is used to connect an event with string s to a function. 3 min read Like