Matplotlib also support text, including mathematical expressions, also TrueType support for raster and vextor outputs, newline separated text with arbitrary.

The user can custromrise the text according his choice. We can change front size, font weight, text location and color, etc. User has a great control over text properties.

Matplotlib also implements a large number of Tex math symbols and commands that provide support to mathematical expression anywhere in figure.

Matplotlib is having it's own function that can implement a cross-platform, W3C compliant font finding algorithm. Matplotlib Text is a tool that allows us ton add text to our graph . It is very easy to add text on axis and any frames.

Here are some basic text commands which we can use to add text on graphs:

**text:**This command is used to add text at an arbitrary location of the Axes.**annotate:**It is used to add annotation at an arbitrary location of the Axes with the help of an arrow(which is optional).**xlabel:**It is used to add a label to the Axes’s x-axis.**ylabel:**It is used to add a label to the Axes’s y-axis.**title:**It is used to add title to the axes.**figtext:**It is used to add text at an arbitrary location of the figure.**suptitle:**It is used to add title to the figure.

## Examples

```
import matplotlib.pyplot as plt
import numpy as np
f=plt.figure()
ax=f.add_subplot(111)
x=np.array([1,2,3,4])
y=np.exp(x)
plt.xlabel('x-axis')
plt.ylabel('y-axis')
plt.title('Random Graph')
plt.text(0.5,0.5,'Welcome To Python',horizontalalignment='center',
verticalalignment='center',transform = ax.transAxes,fontsize=12, color='blue',style='italic')
plt.plot(x,y, marker='o')
plt.show()
```

**Output:**

- Log in to post comments