# Python | Adding Pi in Plot Label

In this article, we are going to learn how to add π (Pi) letter in the plot label in Python?
Submitted by Anuj Singh, on July 18, 2020

PI (π) is very often used greek mathematical letters and has a higher repetition in circular geometry and probability. In this article, we are going to add π using a command in matplotlib.

plt.text(3, 0.4, r'$\pi=100$')


plt.title('Errorbar with 'r'$\pi=100$')
#Adding π in title of the figure


plt.xlabel('Time ('r'$\pi=100)$')
#Adding π in title of the figure


plt.ylabel('Variation ('r'$\pi=100)$')
#Adding π in title of the figure


## Python code for adding omega in plot label

import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(-3, 3)
y = np.tanh(x) + 0.1 * np.cos(5 * x)

# In text
plt.figure()
plt.plot(x, y, 'o', color='purple')
plt.title('Errorbar')
plt.text(2, 0.8, r'$\pi=100$', fontsize=14.0)
plt.grid()
plt.show()

# In title
plt.figure()
plt.plot(x, y, 'o', color='purple')
plt.title('Errorbar with 'r'$\pi=100$')
plt.grid()
plt.show()

# In x-axis label
plt.figure()
plt.plot(x, y, 'o', color='purple')
plt.xlabel('Time ('r'$\pi=100)$')
plt.grid()
plt.show()

# In y-axis label
plt.figure()
plt.plot(x, y, 'o', color='purple')
plt.ylabel('Variation ('r'$\pi=100)$')
plt.grid()
plt.show()


Output:

Output is as figure