adding multiple plots during Plotting lesson in Python #566
Labels
type:enhancement
Propose enhancement to the lesson
type:feedback
Issue to provide feedback on lesson
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,
The text was updated successfully, but these errors were encountered: