Home »
Python »
Python Data Visualization
Python | Adding Lowercase/Uppercase Gamma in Plot Label
Here, we are going to learn how to add lowercase/uppercase gamma in Python plot label?
Submitted by Anuj Singh, on July 23, 2020
𝛾 (lowercase gamma) and 𝝘 (uppercase gamma) are very often used greek mathematical letters. They are mostly used in physics and chemistry and other mathematical expressions, when there is topic related change (for example energy change, radioactive material) and therefore, they have registered importance in languages.
Therefore, matplotlib has defined a command for 𝛾/𝝘 usage.
In this article, we are going to add 𝛾/𝝘 using a command in matplotlib.
1) Lowercase gamma
plt.text(3, 0.4, r'$\gamma=100$')
#Adding 𝛾 as text
plt.title('Lowercase gamma 'r'$\gamma=100$')
#Adding 𝛾 in title of the figure
plt.xlabel('Lowercase gamma ('r'$\gamma=100)$')
#Adding 𝛾 in x axis label of the figure
plt.ylabel('Lowercase gamma ('r'$\gamma=100)$')
#Adding 𝛾 in y axis label of the figure
2) Uppercase Gamma
plt.text(3, 0.4, r'$\Gamma=100$')
#Adding 𝝘 as text
plt.title('Uppercase Gamma 'r'$\Gamma=100$')
#Adding 𝝘 in title of the figure
plt.xlabel('uppercase Gamma ('r'$\Gamma=100)$')
#Adding 𝝘 in x axis label of the figure
plt.ylabel('uppercase Gamma ('r'$\Gamma=100)$')
#Adding 𝝘 in y axis label of the figure
Python code for adding lowercase/uppercase gamma in python plot label
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(10)
y = np.sin(x)*np.exp(x/5)
#Lowercase gamma
#In text
plt.figure()
plt.bar(x,y, color= 'orange')
plt.title('Lowercase gamma')
plt.text(4, 5, r'$\gamma=100$')
plt.show()
#In title
plt.figure()
plt.bar(x,y, color= 'orange')
plt.title('Lowercase gamma 'r'$\gamma=100$')
plt.show()
#In x-axis label
plt.figure()
plt.bar(x,y, color= 'orange')
plt.xlabel('Lowercase gamma ('r'$\gamma=100)$')
plt.show()
#In y-axis label
plt.figure()
plt.bar(x,y, color= 'orange')
plt.ylabel('Lowercase gamma ('r'$\gamma=100)$')
plt.show()
#Uppercase Gamma
#In text
plt.figure()
plt.bar(x,y, color= 'orange')
plt.title('uppercase Gamma')
plt.text(4, 5, r'$\Gamma=100$')
plt.show()
#In title
plt.figure()
plt.bar(x,y, color= 'orange')
plt.title('uppercase Gamma 'r'$\Gamma=100$')
plt.show()
#In x-axis label
plt.figure()
plt.bar(x,y, color= 'orange')
plt.xlabel('uppercase Gamma ('r'$\Gamma=100)$')
plt.show()
#In y-axis label
plt.figure()
plt.bar(x,y, color= 'orange')
plt.ylabel('uppercase Gamma ('r'$\Gamma=100)$')
plt.show()
Output:
Output is as figure