-
Notifications
You must be signed in to change notification settings - Fork 22
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
Out of context and misleading instruction for saving figures #35
Comments
@dleehr FYI. |
My 2 cents is that it'd be better to make sure that earlier on we create a |
@choldgraf I agree with your argument, but am wondering how to apply this here where we are using the There may well be an easy interface to obtaining the |
argg, I just looked through this notebook and it's actually using the non-object-oriented API for Matplotlib all the way through, which IMO is not recommended practice. Would folks be OK with me taking a pass and changing the Matplotlib to use the object-oriented api instead of the pyplot api? E.g. doing: fig, ax = plt.subplots()
ax.scatter(x, y) instead of plt.figure()
plt.scatter(x,y) the former is recommended by the matplotlib community, while the latter is allowed more because a lot of Matlab people already want to plot with that API |
(and to that extent, does anybody know what the |
I'd be all for moving the lesson to using recommended practices. I think the fraction of people in these workshops who are coming over from using Matlab is small. Also, other lessons in this curriculum, in particular the automation one, does I think use the object-oriented API, which was the source of some confusion among the students. (In fact I myself had been under the impression that the reason we're using the pyplot API is because it's what the Jupyter Notebook environment needs for plotting inline. Apparently that's false?) |
It's the one now pointed to on Mybinder.org by the Sharing lesson, as the example for sharing an interactive live Jupyter Notebook. It's in essence a copy of the instructor's version of the notebook, with the interspersed and trailing exercises etc deleted. Easy enough to recreate as a copy, I should add. |
The lesson states the following in section Saving your plots as image files:
This won't work, and it's non-trivial to recover to a way that it does:
fig
here. Normally (in matplotlib documentation commonly found) this is the return value ofplt.figure()
, but we are not using this method here. Instead we useSeaborn.boxplot()
, which does not return an equivalent value.plt.savefig()
would work (as one can find out from testing autocompletion alternatives), but appears to have to be in the same code cell as the one generating the plot. I.e., we can't just insert a new cell here and run this method.The text was updated successfully, but these errors were encountered: