
- Python 3 Basic Tutorial
- Python 3 - Home
- What is New in Python 3
- Python 3 - Overview
- Python 3 - Environment Setup
- Python 3 - Basic Syntax
- Python 3 - Variable Types
- Python 3 - Basic Operators
- Python 3 - Decision Making
- Python 3 - Loops
- Python 3 - Numbers
- Python 3 - Strings
- Python 3 - Lists
- Python 3 - Tuples
- Python 3 - Dictionary
- Python 3 - Date & Time
- Python 3 - Functions
- Python 3 - Modules
- Python 3 - Files I/O
- Python 3 - Exceptions
Drawing multiple figures in parallel in Python with Matplotlib
To draw multiple figures in parallel in Python with matplolib, we can take the following steps−
- Create random data using numpy.
- Add a subplot to the current figure, nrows=1, ncols=4 and at index=1.
- Display data as an image, i.e., on a 2D regular raster, using imshow() method with cmap="Blues_r".
- Add a subplot to the current figure, nrows=1, ncols=4 and at index=2.
- Display data as an image, i.e., on a 2D regular raster, using imshow() method with cmap="Accent_r".
- Add a subplot to the current figure, nrows=1, ncols=4 and at index=3.
- Display data as an image, i.e., on a 2D regular raster, using imshow() method with cmap="terrain_r"
- Add a subplot to the current figure, nrows=1, ncols=4 and at index=4.
- Display data as an image, i.e., on a 2D regular raster, using imshow() method with cmap="twilight_shifted_r".
- 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 data = np.random.rand(5, 5) plt.subplot(1, 4, 1) plt.imshow(data, cmap="Blues_r") plt.subplot(1, 4, 2) plt.imshow(data, cmap="Accent_r") plt.subplot(1, 4, 3) plt.imshow(data, cmap="terrain_r") plt.subplot(1, 4, 4) plt.imshow(data, cmap="twilight_shifted_r") plt.show()
Output
- Related Articles
- Saving multiple figures to one PDF file in matplotlib
- Drawing multiple legends on the same axes in Matplotlib
- Drawing a rectangle with only border in Matplotlib
- How to plot multiple figures as subplots in Python Plotly?
- Matplotlib – Drawing lattices and graphs with Networkx
- How to change the space between bars when drawing multiple barplots in Pandas? (Matplotlib)
- Flushing all current figures in matplotlib
- Drawing average line in histogram in Matplotlib
- Drawing a network graph with networkX and Matplotlib
- Get the list of figures in Matplotlib
- Python matplotlib multiple bars
- How to manipulate figures while a script is running in Python Matplotlib?
- Drawing lines between two plots in Matplotlib
- Plotting distance arrows in technical drawing in Matplotlib
- Multiple axes in Matplotlib with different scales

Advertisements