

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Row and column headers in Matplotlib's subplots
Using the subplot method, we can configure the number of rows and columns. nrows*nclos will create number positions to draw a diagram.
Steps
Number of rows = 2, Number of columns = 1, so total locations are: 2*1 = 2.
Add a subplot to the current figure, nrow = 2, ncols = 1, index = 1.
Add a subplot to the current figure, nrow = 2, ncols = 1, index = 2.
Using plt.show(), we can show the figure.
Example
from matplotlib import pyplot as plt row_count = 2 col_count = 1 index1 = 1 # no. of subplots are: row*col, index is the position of figure. plt.subplot(row_count, col_count, index1) index2 = 2 plt.subplot(row_count, col_count, index2) plt.show()
Output
- Related Questions & Answers
- Animation using Matplotlib with subplots and ArtistAnimation
- Populating Matplotlib subplots through a loop and a function
- 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 zoom subplots together in Matplotlib/Pyplot?
- Plotting grids across the subplots in Python Matplotlib
- Adjusting the heights of individual subplots in Matplotlib in Python
- How to share secondary Y-axis between subplots in Matplotlib?
- Setting the same axis limits for all subplots in Matplotlib
- SAP HANA row and column store table
- Annotate Subplots in a Figure with A, B, C using Matplotlib
- How to increase the spacing between subplots in Matplotlib with subplot2grid?
- How to set same scale for subplots in Python using Matplotlib?
Advertisements