Why does the dpi setting in matplotlib affect the image size?

created at 07-31-2021 views: 6

question

I set the figsize to 6.4 * 6.4 inches, so the output size should be a square with a side length of 6.4 inches, right?
But if the dpi is set to 10, the output image size is pitiful, why is this?
Shouldn't dpi only affect image quality rather than size?

answer

dpi is not what you understand, dpi is dots per inch, that is, how many dots there are in an inch. 

Although you have set it successfully, when the computer reads the picture, it has its own adaptation process, for example, you set it to 10,  then the computer can be directly used in a small size. Because px is an unchangeable quantity for the computer, it can only change the size. 

By the way: px can be directly understood as the dots mentioned above.

created at:07-31-2021
edited at: 07-31-2021: