Python | Symmetric Log Scale Example in Matplotlib

In this article, we are going to set both the axes with symmetric log scale mathematical data visualization.
Submitted by Anuj Singh, on August 14, 2020

Illustration:

Symmetric Log Scale Example (1)

Symmetric Log Scale Example (2)

Symmetric Log Scale Example (3)

Python code for symmetric log scale example in matplotlib

import matplotlib.pyplot as plt
import numpy as np

dt = 0.02
x = np.arange(-50.0, 50.0, dt)
y = np.arange(0, 100.0, dt)

plt.figure(figsize=(7,12))
plt.subplot(311)
plt.plot(x, np.sin(x / 7.0), 'r-', linewidth=0.5)
plt.xscale('symlog')
plt.yscale('symlog', linthresh=0.015)
plt.grid(True)
plt.ylabel('symlog both')
plt.grid()
plt.tight_layout()


plt.subplot(312)
plt.plot(y, x, 'o', color='yellow')
plt.yscale('symlog')
plt.ylabel('symlogy')
plt.grid()

plt.subplot(313)

plt.plot(x, y, linewidth=2.0)
plt.xscale('symlog')
plt.ylabel('symlogx')
plt.grid(True)
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.