- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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 plot the lines first and points last in Matplotlib?
To plot the lines first and points last, we can take the following Steps −
Create xpoints, y1points and y2points using numpy, to draw lines.
Plot the curves using the plot() method with x, y1 and y2 points.
Draw the scatter points using the scatter method.
To 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 xpoints = np.linspace(1, 1.5, 10) y1points = np.log(xpoints) y2points = np.exp(xpoints) plt.plot(xpoints, y1points) plt.plot(xpoints, y2points) for i in xpoints: plt.scatter(i, np.random.randint(10)) plt.show()
Output
- Related Articles
- How to plot overlapping lines in Matplotlib?
- How to remove lines in a Matplotlib plot?
- How to plot blurred points in Matplotlib?
- How to name different lines in the same plot of Matplotlib?
- How to plot two dotted lines and set marker using Matplotlib?
- How to draw axis lines inside a plot in Matplotlib?
- How to plot additional points on the top of a scatter plot in Matplotlib?
- Plot scatter points using plot method in Matplotlib
- How to add vertical lines to a distribution plot (sns.distplot) in Matplotlib?
- How to change the color and add grid lines to a Python Matplotlib surface plot?
- How to set same color for markers and lines in a Matplotlib plot loop?
- Plot scatter points on 3d plot without axes and grids in Matplotlib
- Matplotlib Plot Lines with Colors through Colormap
- How to remove the first and last ticks label of each Y-axis subplot in Matplotlib?
- How to plot scatter points with increasing size of marker in Matplotlib?

Advertisements