That’s not necessarily Python but the 3rd party Matplotlib library. I’m not aware of any built-in method (at least not since I last checked) of using cm instead of inches and I can’t see it happening since it’d likely cause problems with code behaving differently on different machines. If you have a pressing need to size figures in cm you might have to write a quick function or something along those lines to convert the two.
I have 3 questions. Hope someone could help me.
①Why only the latter figure is shown when I call plt.show()? What happened to the first figure?
②What is plt.close('all') for?
③Why do I need to call plt.figure() before plt.plot() and if I reverse the order, no figure will be displayed?