merely-useful / novice-py

Semester long course on introducing and teaching Python to beginners.
https://merely-useful.github.io/novice-r/
Other
1 stars 0 forks source link

Discussion: Which Python plotting library do we teach? #1

Open joelostblom opened 5 years ago

joelostblom commented 5 years ago

My choice would be to teach a declarative, high-level library instead of a imperative, low-level library. The most popular declarative Python libraries I am aware of are seaborn, plotnine, plotly express, holoviews, pandas/pandas_bokeh, and altair.

Here are some thoughts on those, ordered by my experience using them (seaborn and pandas: extensive, holoviews and altair: some, plotnine and plotly express: little).

Among these declarative libraries, seaborn would be my choice for beginners (with some mpl where needed). I can see myself being swayed, most probably if someone has positive plotly express experiences (or if I have time to test the library before we write that section).

joelostblom commented 5 years ago

I have been playing with plotly express the last couple of days and must say that it is quite nice... Setup was easier than what it seemed also, I would novice doable, just a little bit tedius that they need a jupyter extension to show plots and a special library to save as pdf and svg (but at least that works really well and fast in contrast to other interactive libraries)

ChristinaLK commented 5 years ago

I've heard the most about Seaborn, but haven't used it myself - it's what I'd like to learn next. I'd defer to @joelostblom's experience if plotly would better.

mbonsma commented 5 years ago

My vote is for Seaborn:

But ultimately I'm happy to consider other factors, like the long-term outlook we discussed in today's meeting.

joelostblom commented 5 years ago

Three brief notes, I will write in more detail about my recent thoughts on these libraries later.

  1. In the meeting we mentioned the declining rate of updates to seaborn as a disadvantage. I just want to point out that it could also be a sign of a mature, reliable library which is comfortable with the scope it covers.

  2. I recently held a tutorial for my lab (~15 ppl) in plotly express and it was great. Overall a very straightforward experience, more details later.

  3. A friend of mine TAs a course in Altair to new Data Science learners and they are having some headaches getting it set up properly. About a 40-50 (out of 125) of their students could not get plots to show up properly in JupyterLab initially and several are still struggling after a few days. More details including a recommendation from the Altair author to use other editors can be found here:

    A meta point: I too am quite frustrated by the state of frontend extensions in the juptyer notebook and jupyterlab; imagine the troubles you're having with 125 students, and multiply that by the number of Altair users in the world, and you'll get a sense of the support burden involved grin

    Honestly, my recommendation would be to teach using a cloud-based notebook system in which the compute environment is a known factor. There are several possibilities, but I'm biased toward http://colab.research.google.com (full disclosure: I'm employed by Google to work on Colab) because it supports Altair and other common data science tools out of the box, and is free to use for anyone with a Google-backed email account (true of all students and employees at UW).

    (As a side note/tip, I can mention that I used Google Colab for the tutorial I mentioned above and it was a relief to know that everyone had the same environment and not have to deal with individual installation issues (full disclosure: I don't even like Google and still thought this was a great experience).)

joelostblom commented 5 years ago

Also note that I have not seen any way of displaying interactive chart from either Altair or Plotly inside Spyder. At best, a new tab opens in a browser that you have to switch to (for me, this is an argument against using spyder rather than against any of the two plotting libraries). Plotly works in the notebook and I read PyCharm (haven't tested myself). Altair works in the notebook (with the caveats in my previous post), I did not find any info on PyCharm support.