- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
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 Articles
- How to set my xlabel at the end of X-axis in Matplotlib?
- How to set X-axis values in Matplotlib Python?
- Find the point on the x-axis which is equidistant from $(2, -4)$ and $(-2, 6)$.
- Multiply:$(x^6-y^6)$ by $(x^2+y^2)$
- How to set axis ticks in multiples of pi in Python Matplotlib?
- How to specify values on Y-axis in Python Matplotlib?
- How to show date and time on the X-axis in Matplotlib?
- The reduced form of $36 x^{2}-81 y^{2}$ isi$(6 x+9 y)(6 x-9 y) $ii$(6 x+9 y)(4 x-5) $iii.$(9 x+6 y)(9 x-6 y)$iv. $(9 y-6 x)(9 y+6 x) $
- How to customize the X-axis in Matplotlib?
- How to customize X-axis ticks in Matplotlib?
- How to set the current figure in Matplotlib?
- How to place X-axis grid over a spectrogram in Python Matplotlib?
- Factorize:$x^2 + 6sqrt{2}x + 10$
- Which point on x-axis is equidistant from $(5, 9)$ and $(-4, 6)$?
- Factorize:$x^{2} + 5x − 6$

Advertisements