

- 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
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 Questions & Answers
- Matplotlib legends in subplot
- Absolute and Relative Imports in Python
- Absolute and Relative frequency in Pandas
- How to replace auto-labelled relative values by absolute values in Matplotlib?
- CSS Absolute and Relative Units
- Understanding CSS Absolute and Relative Units
- Absolute and Relative Magnetic Permeability (µ)
- How do I change matplotlib's subplot projection of an existing axis?
- Rotating axis text for each subplot in Matplotlib
- Setting active subplot using axes object in Matplotlib
- Pythonic way of detecting outliers in one dimensional observation data using Matplotlib
- How to make longer subplot tick marks in Matplotlib?
- What is the difference between relative and absolute XPath in Selenium?
- How to rotate tick labels in a subplot in Matplotlib?
- Changing Matplotlib subplot size/position after axes creation
Advertisements