datacarpentry / python-ecology-lesson

Data Analysis and Visualization in Python for Ecologists

Home Page:https://datacarpentry.org/python-ecology-lesson

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

from @crocodoyle: Pyplot tutorial should close plots

fmichonneau opened this issue · comments

In lesson 7, (http://www.datacarpentry.org/python-ecology-lesson/07-putting-it-all-together/), none of the examples close pyplot. This isn't a problem if only following the examples, but very important if you're creating figures in loops or creating lots of plots.

initially submited at: datacarpentry/datacarpentry.github.io#430

In the spirit of following this line would it be good to actually add this observation to the lesson itself + close the plots in the examples.

It might be obvious but as this is obvious some people might forget to mention it when teaching /following the lesson

+1 for adding this to the lesson

I do think this intersects with the comments about the #254 and the main discussion about rewriting the putting-it-all-together lesson.

With regard to the plotting, it would maybe be beneficial to learn people how make Pandas based plotting using the object oriented approach of matplotlib instead of the plt.*** approach of plotting (and requirement of closing plots). e.g.

# create object
fig, ax = plt.subplots()

# add something on the ax directly from pandas
df.plot(..., ax = ax,..)

# do further adjustments with matplotlib syntax
ax.set_title(...

As such, it connects with the previous lessons and the plots made there (using Pandas) and this can be applied to the plotnine lesson as well (these are also matplotlib objects). As it is now, it feels like a whole new concept in a lesson called putting-it-all-together...

Closing in favor of #254