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

adding multiple plots during Plotting lesson in Python #566

Open
bdemirb opened this issue Sep 7, 2021 · 2 comments
Open

adding multiple plots during Plotting lesson in Python #566

bdemirb opened this issue Sep 7, 2021 · 2 comments
Labels
type:enhancement Propose enhancement to the lesson type:feedback Issue to provide feedback on lesson

Comments

@bdemirb
Copy link

bdemirb commented Sep 7, 2021

When the gapminder_gdp_X data is plotted to see how GDP increased per year, it would be useful to generate multiple plots to compare gdps of different countries, especially where GDPs are too different in values. I believe adding this section to the lesson will help learners appreciate more the power of plotting in Python.

To this end, "subplots" command can be used to generate multiple plots:

fig, axs = plt.subplots(2,2, figsize=(8,8), sharex = True, sharey = False)
fig.subplots_adjust(hspace=0.1, wspace = 0.1)

Let's assume we generate 4 plots in a 2x2 format --> (2,2)
We adjust the size of the entire block --> (figsize=(8,8)
Because the GDPs will be very different for countries (y-axis), choosing sharey = False is fair. Since the period covered by the data is the same, it is fair to keep the x-axis the same (sharex= True).

With hspace and wspace, the white space between plots can be adjusted.

hspace --> the height of the padding between subplots
wspace --> the width of the padding between subplots,

@alee alee added type:enhancement Propose enhancement to the lesson type:feedback Issue to provide feedback on lesson labels Dec 17, 2021
@lherwehe
Copy link

lherwehe commented Jul 13, 2022

@bdemirb I like this suggestion for the Plotting episode. I agree that it allows learners to further understand the real world application of this skill.

If it's added to the lesson, the content on creating figures with multiple plots with matplotlib from earthdatascience.org could be used (under CC 4.0 license like the Carpentries so can be used/built upon with attribution!).

I do understand that there's more of a need to trim than add to Carpentries lessons---directing to the earthdatascience.org lesson at the bottom under a header like Additional Resources could be a way to avoid making the lesson longer.

@vahtras
Copy link
Contributor

vahtras commented Jul 13, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement Propose enhancement to the lesson type:feedback Issue to provide feedback on lesson
Projects
None yet
Development

No branches or pull requests

4 participants