Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. The
figure module provides the top-level Artist, the Figure, which contains all the plot elements. This module is used to control the default spacing of the subplots and top level container for all plot elements.
matplotlib.figure.Figure.set_tight_layout() method
The
set_tight_layout() method figure module of matplotlib library is used to set whether and how tight_layout is called when drawing.
Syntax: set_tight_layout(self, tight)
Parameters: This method accept the following parameters that are discussed below:
- tight : This parameters contains the boolean value or dict with keys "pad", "w_pad", "h_pad", "rect" or None.
Returns: This method does not returns any value.
Below examples illustrate the matplotlib.figure.Figure.set_tight_layout() function in matplotlib.figure:
Example 1:
Output:
👁 Image
Example 2: