- Trending Categories
- Data Structure
- Operating System
- C Programming
- 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.
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()
- How to increase the distance between boxplots using ggplot2 in R?
- 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?
- Adjusting the spacing between the edge of the plot and the X-axis in Matplotlib
- How to increase the font size of the legend in my Seaborn plot using 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?
- Plot animated text on the plot in Matplotlib
- Increase the space between facets in a facetted plot created using ggplot2 in R.
- How to increase the space between bars of a bar plot using ggplot2 in R?
- How to remove the plot margin in base R between the axes and the points inside the plot?
- How to write the plot title in multiple lines using plot function in R?
- How do I adjust (offset) the colorbar title in Matplotlib?
- How to put the title at the bottom of a figure in Matplotlib?
- Set the distance between the marker and the text relating to that marker with CSS