ADVERTISEMENT
ADVERTISEMENT

# Python | Fraction in Matplotlib

In this article, we are going to learn how to plot a fraction in figure using matplotlib?
Submitted by Anuj Singh, on August 20, 2020

Illustrations:

## Python code for fraction in matplotlib

import matplotlib.pyplot as plt

plt.figure()
plt.text(0.5, 0.5, r"$\frac{4}{32}$", fontsize=60)
plt.axis(False)
plt.show()

plt.figure()
plt.text(0.5, 0.5, r"$\frac{1}{3}$", fontsize=60)
plt.axis(False)
plt.show()

plt.figure()
plt.text(0.5, 0.5, r"$\frac{a}{b}$", fontsize=60)
plt.axis(False)
plt.show()


Output:

Output is as Figure

ADVERTISEMENT

ADVERTISEMENT

Comments and Discussions

ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.