- 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 change xticks font size in a matplotlib plot?
To change the font size of xticks in a matplotlib plot, we can use the fontsize parameter.
Steps
Import matplotlib and numpy.
Set the figure size and adjust the padding between and around the subplots.
Create x and y data points using numpy.
Plot the x and y data points using plot() method.
Set the font size of xticks using xticks() method.
To display the figure, use show() method.
Example
from matplotlib import pyplot as plt import numpy as np # Set the figure size plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True # x and y data points x = np.linspace(-5, 5, 100) y = np.sin(x) plt.plot(x, y) # Set the font size of xticks plt.xticks(fontsize=25) # Display the plot plt.show()
Output
It will produce the following output −
- Related Articles
- How to change the font size of scientific notation in Matplotlib?
- How to change the font size of legend in base R plot?
- Matplotlib – How to set xticks and yticks with imshow plot?
- How to plot a Pandas multi-index dataFrame with all xticks (Matplotlib)?
- How to change font size in HTML?
- How to change font size in ttk.Button?
- How to increase plt.title font size in Matplotlib?
- How to increase the font size of the legend in my Seaborn plot using Matplotlib?
- How do I change the font size of the scale in Matplotlib plots?
- How to modify the font size in Matplotlib-venn?
- How can I change the font size of ticks of axes object in Matplotlib?
- How do I change the axis tick font in a Matplotlib plot when rendering using LaTeX?
- How to change the font size of textView in android?
- How to change PowerShell ISE font Size using command?
- How to change the font size of a text using JavaScript?

Advertisements