Python saving matplotlib figure to PDF as exact physical size
I’m creating a program, which places circles on a fixed graph based on user input, and after that the user has the option to generate a PDF from that figure. However, if I try to save the figure as PDF, the figure never keeps it’s exact physical size, but it is very important. For example, if my math is right, the Y axis should be always 100mm long, as you can see in the adjust_graph_X() function. The user has the option to relength the X axis, thats why we have this adjust function. After generating the PDF, the Y axis is never 100mm on the PDF, it is bigger, or smaller, depending on the X axis length, and the PDF autoscale or I do not know.