4 ms·
You're right that matplotlib has an unpleasant API - I've never had a good experience with matplotlib, but I've used Altair for a few data viz tasks and love it
by brilee 8y ago
You're right that matplotlib has an unpleasant API - I've never had a good experience with matplotlib, but I've used Altair for a few data viz tasks and love it.
Matplotlib intentionally took on the API that Matlab had created, to make it easier for Matlab users to jump over to the Python ecosystem. But today, very few people are coming to Python from a Matlab background so the API just looks wonky.
- mkl 8y agoMatplotlib basically has two APIs, the global state Matlab-like one PyPlot (which is often used in beginner tutorials), and a much nicer object-oriented API, where state is explicitly connected to the plot components. To quote from their documentation [1]: "While it is easy to quickly generate plots with the matplotlib.pyplot module, we recommend using the object-oriented approach for more control and customization of your plots." I use matplotlib.pyplot for basically only two purposes, calling subplots to get figure and axis objects, or calling rc_context to set up a "with" block with certain settings (e.g. font size). That said, I'm certainly watching where alternative plotting libraries are going. I've used bqplot a bit, but only played around with others so far. [1] https://matplotlib.org/api/pyplot_summary.html#the-object-oriented-api https://matplotlib.org/api/pyplot_summary.html#the-object-or...