- 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 can I show figures separately in Matplotlib?
To show multiple figures in matplotlib, we can take the following Steps −
To create a new figure, or activate an existing figure, use the figure() method. (Create two figures namely, Figure1 and Figure2).
Plot the lines with the same lists (colors red and green and linewidth 2 and 5).
Set the title of the plot over both the figures.
To display the figure, use the show() method.
Example
from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True fig1 = plt.figure("Figure 1") plt.plot([1, 3, 7, 3, 1], c="red", lw=2) plt.title("I am the part of figure 1") fig2 = plt.figure("Figure 2") plt.plot([1, 3, 7, 3, 1], c="green", lw=5) plt.title("I am the part of figure 2") plt.show()
Output
- Related Articles
- How to show two figures using Matplotlib?
- How can I get pyplot images to show on a console app? (Matplotlib)
- How to customize spines of Matplotlib figures?
- Flushing all current figures in matplotlib
- How can I plot hysteresis threshold in Matplotlib?
- Get the list of figures in Matplotlib
- How can I draw inline line labels in Matplotlib?
- How can I hide the axes in Matplotlib 3D?
- How can I cycle through line styles in Matplotlib?
- How can I plot a confusion matrix in matplotlib?
- How to save figures to pdf as raster images in Matplotlib?
- How to show Matplotlib in Flask?
- Drawing multiple figures in parallel in Python with Matplotlib
- How can I plot a single point in Matplotlib Python?
- How I can get a Cartesian coordinate system in Matplotlib?

Advertisements