- 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
How to show two figures using Matplotlib?
We can use the method, plt.figure(), to create the figures, and then, set their titles by passing strings as arguments.
Steps
Create a new figure, or activate an existing figure, with the window title “Welcome to figure 1”.
Draw a line using plot() method, over the current figure.
Create a new figure, or activate an existing figure, with the window title “Welcome to figure 2”.
Draw a line using plot() method, over the current figure.
Using plt.show(), show the figures.
Example
from matplotlib import pyplot as plt plt.figure("Welcome to figure 1") plt.plot([1, 3, 4]) plt.figure("Welcome to figure 2") plt.plot([11, 13, 41]) plt.show()
Output
- Related Articles
- How can I show figures separately in Matplotlib?
- How to customize spines of Matplotlib figures?
- How to show node name in Matplotlib graphs using networkx?
- How to save figures to pdf as raster images in Matplotlib?
- How to show two different colored colormaps in the same imshow Matplotlib?
- How to show Matplotlib in Flask?
- Flushing all current figures in matplotlib
- How to manipulate figures while a script is running in Python Matplotlib?
- Saving multiple figures to one PDF file in matplotlib
- How to show multiple colorbars in Matplotlib?
- Get the list of figures in Matplotlib
- How to plot two histograms side by side using Matplotlib?
- How to make Matplotlib show all X coordinates?
- How to show legend elements horizontally in Matplotlib?
- How to plot two dotted lines and set marker using Matplotlib?

Advertisements