
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
Display Matplotlib Y-Axis Range Using Absolute Values
To display Y-axis range using absolute values rather than offset values, we can take the following steps −
Create x_data and y_data data points in the range of 100 to 1000.
Create a figure and a set of subplots using subplots() method.
Plot x_data and y_data using plot() method.
If a parameter is not set, the corresponding property of the formatter is left unchanged using ticklabel_format() method with useOffset=False.
To display the figure, use show() method.
Example
from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True x_date = range(100, 1000, 100) y_data = range(100, 1000, 100) fig, ax = plt.subplots() ax.plot(x_date, y_data) ax.ticklabel_format(useOffset=False) plt.show()
Output
Advertisements