Figure size, aspect ratio and DPI

Let’s learn about managing the figure size, aspect ratio, and DPI of images using matplotlib.

We'll cover the following

Figure size

When creating a figure object, matplotlib allows the aspect ratio, DPI and figure size to be specified. We can do these using the following methods:

  • figsize: This allows us to adjust the width and height of the figure in inches.

  • dpi: This allows us to specify the number of pixels or dots per inch.

Get hands-on with 1400+ tech skills courses.