Live data from Hacker News

Matplotlib

matplotlib.org

41–44 of 44 posts

Re: Matplotlib

#41

Matplotlib is a fantastic library even if I don’t love the API. The name and API come from MATLAB, and once you realize that it makes more sense. It was originally meant to replicate the plotting functionality in python to be familiar to MATLAB users. IMO this is what makes it feel non-pythonic, but it was never really a python API in the first place.

Exactly! Typing "import matplotlib" at the python REPL instantly gave you the capability of Matlab without the requirement of a commercial license. If I recall correctly, matplotlib was built after Matlab increased the prices for its commercial license for academics. Between matplotlib and pandas I believe we have a sufficient explanation as to how python became the language of choice for data analysis.

Both have excellent features and confusing APIs.

Re: Matplotlib

#42
post #24

Bokeh has a much more sensible API, and it generates an interactive HTML plot by default. Unfortunately it's missing quite a few specialized plots from matplotlib, in particular the popular histogram plot is strangely difficult to draw.

Have you tried Altair? I am considering switching away from Plotly and have been eyeing Altair. (I have no idea how good it is.)

Re: Matplotlib

#43
My pet-peeve with matplotlib is the terrible layout of multiple plots on a grid. It's tedious (requires quite a bit of redundant typing), setting aspect ratios is tricky, getting margins right is an effort of trial and error -- setting reasonable font-sizes will almost certainly get you overlapping axes labels (especially when using tight_layout) by default.

Don't get me wrong matplotlib still gives the best looking publication-ready plots (people mentioned bokeh, which is great for interactive plots on the web, but completely unsuitable for creating plots for pdf articles). I just sometimes wish less tweaking was required.

I found proplot: https://proplot.readthedocs.io/en/stable/ is a nice wrapper around matplotlib that alleviates quite a few issues.

Re: Matplotlib

#44
post #24

Bokeh has a much more sensible API, and it generates an interactive HTML plot by default. Unfortunately it's missing quite a few specialized plots from matplotlib, in particular the popular histogram plot is strangely difficult to draw.

Have you tried Altair? I am considering switching away from Plotly and have been eyeing Altair. (I have no idea how good it is.)

I'm moving the opposite direction: Altair -> Plotly. I find altair to be too "grammar of graphics" for its own good. And the vega backend makes it hard to hack around. Saving to pdf or high-quality also takes extra steps with additional dependencies.
Post reply on HN