- 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
Increase the distance between the title and the plot in Matplotlib
To increase the distance between the title and the plot in matplotlib, we can take the following steps −
Create point x using numpy.
Create point y using numpy sin.
Set the title of the plot. After changing the value y (in argument), we can increase or decrease the distance between the title and the plot.
Plot x and y points using the plot() method, where color is red and line width is 2.
Ti display the figure, use the show() method.
Example
import numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True x = np.linspace(1, 10, 1000) y = np.sin(x) ttl = plt.title('Sine Curve', y=1.05) plt.plot(x, y, c="red", lw=2) plt.show()
Output
- Related Articles
- How to update the plot title with Matplotlib using animation?
- How do I make the width of the title box span the entire plot in Matplotlib?
- How to increase the font size of the legend in my Seaborn plot using Matplotlib?
- How to increase the distance between boxplots using ggplot2 in R?
- Adjusting the spacing between the edge of the plot and the X-axis in Matplotlib
- How to increase the spacing between subplots in Matplotlib with subplot2grid?
- How to put the plot title inside the plot using ggplot2 in R?
- Increase the space between facets in a facetted plot created using ggplot2 in R.
- Plot animated text on the plot in Matplotlib
- How to write the plot title in multiple lines using plot function in R?
- How to increase the space between bars of a bar plot using ggplot2 in R?
- How do I adjust (offset) the colorbar title in Matplotlib?
- How to change the Y-axis title in base R plot?
- How to put the title at the bottom of a figure in Matplotlib?
- Setting the Matplotlib title in bold while using "Times New Roman"

Advertisements