- 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
Adding caption below X-axis for a scatter plot using Matplotlib
To add caption below X-axis for a scatter plot, we can use text() method for the current figure.
Steps
Create x and y data points using numpy.
Create a new figure or activate an existing figure using figure() method.
Plot the scatter points with x and y data points.
To add caption to the figure, use text() method.
Adjust the padding between and around the subplots.
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 x = np.random.rand(10) y = np.random.rand(10) fig = plt.figure() plt.scatter(x, y, c=y) fig.text(.5, .0001, "Scatter Plot", ha='center') plt.tight_layout() plt.show()
Output
- Related Articles
- Adding a line to a scatter plot using Python's Matplotlib
- Plot scatter points on polar axis in Matplotlib
- Plot scatter points using plot method in Matplotlib
- Adding a scatter of points to a boxplot using Matplotlib
- Adding extra axis ticks using Matplotlib
- How to make a discrete colorbar for a scatter plot in matplotlib?
- Plot a 3D surface from {x,y,z}-scatter data in Python Matplotlib
- How to draw an average line for a scatter plot in MatPlotLib?
- How to animate a scatter plot in Matplotlib?
- Show the origin axis (x,y) in Matplotlib plot
- Moving X-axis in Matplotlib during real-time plot
- How to plot data against specific dates on the X-axis using Matplotlib?
- Controlling the alpha value on a 3D scatter plot using Python and Matplotlib
- Python Scatter Plot with Multiple Y values for each X
- How to use different markers for different points in a Pylab scatter plot(Matplotlib)?

Advertisements