Python | Plotting in Plane Figure

Python | Plotting in Plane Figure: In this tutorial, we will learn how to plot in a plane figure i.e., a figure with no axis and no ticks? By Anuj Singh Last updated : August 18, 2023

Plotting in Plane Figure

It helps in looking good and therefore matplotlib has provided this feature with the help of matplotlib.pyplot.axis(False) function.

Examples

Python | Plotting in Plane Figure (1) Python | Plotting in Plane Figure (2) Python | Plotting in Plane Figure (3) Python | Plotting in Plane Figure (4)

Python program for plotting in plane figure

import numpy as np
import matplotlib.pyplot as plt

an = np.linspace(0, 2*np.pi, 100)
plt.figure()
plt.plot(3*np.cos(an), 3*np.sin(an))
plt.box()
plt.axis(False)
plt.show()

plt.figure()
plt.plot(np.arange(25), np.random.randint(45,60,25), 'o-', color='purple')
plt.box()
plt.axis(False)
plt.show()

plt.figure()
plt.bar(np.arange(25), np.random.randint(45,60,25), color='purple', alpha=0.6)
plt.box()
plt.axis(False)
plt.show()

plt.figure()
plt.arrow(0.3, 0.4, 0.3, 0, head_width=0.05, head_length=0.07)
plt.text(0.25, 0.375, 'A', fontsize=18)
plt.text(0.7, 0.375, 'B', fontsize=18)
plt.box()
plt.axis(False)
plt.show()

Output:

Output is as figure

Comments and Discussions!

Load comments ↻





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