Python | Plotting in Plane Figure

In this tutorial, we are going to learn how to plot in a plane figure i.e. a figure with no axis and no ticks?
Submitted by Anuj Singh, on August 01, 2020

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

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 code 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

Ad: Are you a blogger? Join our Blogging forum.





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.