rougier / scientific-visualization-book

An open access book on scientific visualization using python and matplotlib
https://www.labri.fr/perso/nrougier/
Other
10.66k stars 986 forks source link

Subplot margins (Chapter 1, Exercise 2) #59

Closed labdmitriy closed 2 years ago

labdmitriy commented 2 years ago

Hi @rougier,

There is a statement about additional figure margins for Exercise 2 solution: https://github.com/rougier/scientific-visualization-book/blob/a6e0607fa8dbcfa5e6251cd7b64b5a094ad4e0f9/code/anatomy/inch-cm.py#L13-L15 And there is a code that performs this adjustment: https://github.com/rougier/scientific-visualization-book/blob/a6e0607fa8dbcfa5e6251cd7b64b5a094ad4e0f9/code/anatomy/inch-cm.py#L27-L38 It seems that in this case we need to have 0.125 inches margin on each side (not 0.25 as in the description), and margin=0.25 (not 0.125 as in the code) because we multiply this margin by 0.5 when we call plt.subplots_adjust(). Is it correct?

Thank you.

rougier commented 2 years ago

You're right. We need 0.125 margin on each side and the 0.5* is confusing (and wrong). Figure in the book seems to be the right size but probably the difference is not noticeable. Can you make a PR?