- 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
Adjust one subplot's height in absolute way (not relative) in Matplotlib
To adjust one subplot's height in absolute way in Matplotlib, we can take the following steps −
- Set the figure size and adjust the padding between and around the subplots.
- Create a new figure or activate an existing figure.
- For absolute height of subplot, use Axes() class
- Add an axes to the figure.
- Plot the data points on the axes.
- To display the figure, use show() method.
Example
from matplotlib import pyplot as pl pl.rcParams["figure.figsize"] = [7.50, 4.50] pl.rcParams["figure.autolayout"] = True figure = pl.figure() axes = pl.Axes(figure, [.4, .6, .25, .25]) figure.add_axes(axes) pl.plot([1, 2, 3, 4], [1, 2, 3, 4]) axes = pl.Axes(figure, [.4, .1, .25, .25]) figure.add_axes(axes) pl.plot([1, 2, 3, 4], [1, 2, 3, 4]) pl.show()
Output
- Related Articles
- How to replace auto-labelled relative values by absolute values in Matplotlib?
- Absolute and Relative Imports in Python
- Absolute and Relative frequency in Pandas
- CSS Absolute and Relative Units
- How to Adjust Marker Size in Matplotlib?
- Understanding CSS Absolute and Relative Units
- Absolute and Relative Magnetic Permeability (µ)
- Pythonic way of detecting outliers in one dimensional observation data using Matplotlib
- Adjust the width of box in boxplot in Python Matplotlib
- Auto adjust font size in Seaborn heatmap using Matplotlib
- What is the difference between relative and absolute XPath in Selenium?
- How to change/convert absolute reference to relative reference in Excel?
- Setting a relative frequency in a Matplotlib histogram
- How to remove relative shift in Matplotlib axis?
- Get an Absolute Filename Path from a Relative Filename Path in Java

Advertisements