×

Python Tutorial

Python Basics

Python I/O

Python Operators

Python Conditions & Controls

Python Functions

Python Strings

Python Modules

Python Lists

Python OOPs

Python Arrays

Python Dictionary

Python Sets

Python Tuples

Python Exception Handling

Python NumPy

Python Pandas

Python File Handling

Python WebSocket

Python GUI Programming

Python Image Processing

Python Miscellaneous

Python Practice

Python Programs

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 | Fraction in Matplotlib (1)

Python | Fraction in Matplotlib (2)

Python | Fraction in Matplotlib (3)

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!

Load comments ↻


Advertisement
Advertisement
Advertisement

Copyright © 2025 www.includehelp.com. All rights reserved.