- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the difference between 'log' and 'symlog' in matplotlib?
Log helps to make a plot with log scaling on both the X and Y axis, whereas symlog (symmetric log) is used for axis scaling.
Steps
First, we can adjust the subplot layout parameters.
Return an evenly spaced value (t) within a given interval, using the numpy.arrange() method.
Add a subplot to the current figure, with nrows = 1, ncols = 2 and current index is 1.
Make a plot with log scaling on the Y axis, using the semilogy() method.
Set the title for the axes, using the plt.title() method.
Configure the grid lines, using the grid(True) method.
Create two evenly spaced values within a given interval using the numpy.arrange() method.
Add a subplot to the current figure with nrows = 1, ncols = 2 and current index is 2.
Plot using the plt.plot() method with two lists that have been created in step 7.
Set the X-axis scale, using xscale.
Set the title for the axes, using the plt.title() method.
Configure the grid lines, using the grid(True) method.
To show the figure, use the plt.show() method.
Example
import numpy as np import matplotlib.pyplot as plt plt.subplots_adjust(hspace=0.4) t = np.arange(0.01, 20.0, 0.01) # log y axis plt.subplot(121) plt.semilogy(t, np.exp(-t/5.0)) plt.title('Log') plt.grid(True) x = np.arange(-50.0, 50.0, 0.01) y = np.arange(0, 100.0, 0.01) plt.subplot(122) plt.plot(x, y) plt.xscale('symlog') plt.title('Symmetry Log') plt.grid(True) plt.show()
Output
- Related Articles
- Plot yscale class linear, log, logit and symlog by name in Matplotlib?
- What is the difference between plt.close() and plt.clf() in Matplotlib?
- What is the difference between importing matplotlib and matplotlib.pyplot?
- What is the difference between plt.show and cv2.imshow in Matplotlib?
- What is the difference betweent set_xlim and set_xbound in Matplotlib?
- Matplotlib – Difference between plt.subplots() and plt.figure()
- How to plot contourf and log color scale in Matplotlib?
- What is the difference between drawing plots using plot, axes or figure in matplotlib?
- What is the difference between $ and @ in R?
- What is the difference between == and === in JavaScript?
- How to remove scientific notation from a Matplotlib log-log plot?
- What Is Log aa
- What is the difference between /* */ and /** */ comments in Java?
- What is the difference between NA and in R?
- What is the difference between | and || operators in c#?
