Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
How to decrease the density of tick labels in subplots in Matplotlib?
To decrease the density of tick labels in subplots in matplotlib, we can assign the minimum value to density.
Steps
Initialize a variable, density.
Create x and y data points using numpy.
Plot x and y data points using plot() method.
Get or set the current tick locations and labels of the X-axis using xticks() method.
To display the figure, use show() method.
Example
import numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True density = 10 x = np.linspace(-2, 2, density) y = np.sin(x) plt.plot(x, y) plt.xticks(x) plt.show()
Output

Advertisements
