Why Matplotlib Figure Inches Don’t Match Your Screen Inches and How to Fix it

Ted Petrou
Dunder Data
Published in
4 min readDec 9, 2021

--

If you’ve worked with the matplotlib data visualization library before, then you’ll be familiar with the term figsize, which is measured in figure inches. In a Jupyter Notebook, these default to 6 inches in width by 4 inches in height. But, if you actually measured the physical screen inches on your monitor, you’re likely to get different numbers. This post details why this mismatch exists and how to change the settings of your plot so that the matplotlib figure inches match the physical screen inches exactly.

--

--

Ted Petrou
Dunder Data

Author of Master Data Analysis with Python and Founder of Dunder Data