

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Logscale plots with zero values in Matplotlib
To logscale plots with zero values in matplotlib, we can use xscale() and yscale() methods with "symlog" class by name.
Steps
Set the figure size and adjust the padding between and around the subplots.
Plot two lists containing zero values using plot() method.
Use yscale() method with "symlog" class by name.
Use xscale() method with "symlog" class by name.
To display the figure, use show() method.
Example
from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True plt.plot([0, 1, 2, 0, 3], [1, 0, 2, 3, 5], marker='o', linestyle='-') plt.yscale('symlog') plt.xscale('symlog') plt.show()
Output
- Related Questions & Answers
- How to reuse plots in Matplotlib?
- Fixing color in scatter plots in Matplotlib
- How to get multiple overlapping plots with independent scaling in Matplotlib?
- How to add annotations in Matplotlib Plots?
- Embedding small plots inside subplots in Matplotlib
- Drawing lines between two plots in Matplotlib
- Annotate bars with values on Pandas bar plots in Python
- How does one insert statistical annotations (stars or p-values) into Matplotlib plots?
- How to display print statements interlaced with Matplotlib plots inline in iPython?
- Defining multiple plots to be animated with a for loop in Matplotlib
- How to save Matplotlib 3d rotating plots?
- Scroll backwards and forwards through Matplotlib plots
- Save the plots into a PDF in matplotlib
- Show Matplotlib plots (and other GUI) in Ubuntu
- How to create a vector with zero values in R?
Advertisements