How to set the width and height of a figure in Matplotlib in Python

Setting the width and height of a Matplotlib figure creates a figure with a specified width and height in inches.

Solution for How to set the width and height of a figure in Matplotlib in Python : You can use matplotlib.pyplot.figure() to set the width and height of a figure Create a tuple of the form (width, height), where width and height are the dimensions in inches. Call matplotlib.pyplot.figure(figsize=size) with size as the tuple to create a figure with width and height.


how-to-set-the-width-and-height-of-a-figure-in-matplotlib-in-python