- 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
Adjusting the heights of individual subplots in Matplotlib in Python
To adjust the heights of individual subplots in Matplotlib in Python, we can take the following steps −
- Set the figure size and adjust the padding between and around the subplots.
- Add a subplot to the current figure, nrows=7, ncols=2 and at index=1.
- Add a subplot to the current figure, nrows=2, ncols=2 and at index=3
- Add a subplot to the current figure, nrows=1, ncols=3 and at index=3
- To display the figure, use show() method.
Example
import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True plt.subplot(7, 2, 1) plt.subplot(2, 2, 3) plt.subplot(1, 3, 3) plt.show()
Output
- Related Articles
- Plotting grids across the subplots in Python Matplotlib
- Adjusting Text background transparency in Matplotlib
- Adjusting gridlines and ticks in Matplotlib imshow
- How to set same scale for subplots in Python using Matplotlib?
- Embedding small plots inside subplots in Matplotlib
- Manipulation on vertical space in Matplotlib subplots
- Manipulation on horizontal space in Matplotlib subplots
- Draw a border around subplots in Matplotlib
- How to decrease the density of tick labels in subplots in Matplotlib?
- Adjusting the spacing between the edge of the plot and the X-axis in Matplotlib
- Python xticks in subplots
- How to zoom subplots together in Matplotlib/Pyplot?
- Setting the same axis limits for all subplots in Matplotlib
- Row and column headers in Matplotlib's subplots
- How to increase the spacing between subplots in Matplotlib with subplot2grid?

Advertisements