

- 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
How to set "step" on axis X in my figure in Matplotlib Python 2.6.6?
To set Step on X-axis in a figure in Matplotlib Python, we can take the following Steps −
Steps
- Create a list of data points, x.
- Add a subplot to the current figure using subplot() method.
- Set xticks and ticklabels with rotation=45.
- To display the figure, use show() method.
Example
import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True x = [1, 2, 3, 4] y = [1.2, 1.9, 3.1, 4.2] plt.plot(x,y) ax1 = plt.subplot() ax1.set_xticks(x) ax1.set_xticklabels(["one", "two", "three", "four"], rotation=45) plt.show()
Output
- Related Questions & Answers
- Sum of the series 2 + (2+4) + (2+4+6) + (2+4+6+8) + ... + (2+4+6+8+...+2n) in C++
- How to set X-axis values in Matplotlib Python?
- How to set my xlabel at the end of X-axis in Matplotlib?
- How to install the latest version of Git on CentOS 7.x/6.x?
- Find the value of the function Y = (X^6 + X^2 + 9894845) % 981 in C++
- 3-6-9 in Python
- What is Wireless Fidelity 6 (WiFi 6)?
- Set 6-item tuple in C#’
- How to create 6-Tuple in C#?
- How to set the current figure in Matplotlib?
- How to show date and time on the X-axis in Matplotlib?
- How to customize the X-axis in Matplotlib?
- How to customize X-axis ticks in Matplotlib?
- Aligning table to X-axis using matplotlib Python
- Plotting dates on the X-axis with Python's Matplotlib
Advertisements