Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Episode 3 - Visualizing Tabular Data: fig.tight_layout() Suggestion #859

lcolosi opened this issue Aug 6, 2020 · 1 comment


Copy link

lcolosi commented Aug 6, 2020

In the third episode, Visualizing Tabular Data, it states in subsection Grouping Plots:

...the rest of the program tells the plotting library how large we want the figure to be, that we’re creating three subplots, what to draw for each one, and that we want a tight layout. (If we leave out that call to fig.tight_layout(), the graphs will actually be squeezed together more closely.)

The bolded portion of the sentence above could be a little confusing for the learner for two reasons.

  1. Stating that the command fig.tight_layout() makes the subplots have a tight layout doesn't provide learners an understanding of what the command is really doing.
  2. After the claim "we want a tight layout", we state that if we exclude this command, the graphs would be squeezed tighter together. This could confuse the learner because this is technically what we said would happen if we use the command (i.e. a tight layout).

I suggest rewriting this bolded section above as follows:

...and that we want to adjust the subplot's parameters (extents of ticklabels, axis labels, and titles) so that the subplots fit the figure area.

Or if that is too much accessory information, we could say more simply:

...and that the subplots fit the figure area.

The second option may be more well suited for learners to avoid cognitive overload. This is a really small detail, but I think it could reduce possible confusion for future learners. For reference, I got my information about the tigh_layout function from the matplotlib documentation website. Let me know what you all think. I am will to do a pull request if you all think this should be changed. Thank you all for your time!

All the best,


Copy link

maxim-belkin commented Aug 6, 2020

Hi Luke. I agree with your concern and suggestions. I think that the wording for .tight_layout() shouldn't be very thorough because for our purposes this is a matplotlib's quirk rather than a programming principle, so I think a shorter description would be better (e.g., "that the subplots better fit the figure area" or "subplots are better placed in the figure area").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

2 participants