r/Python • • Apr 21 '22

Discussion Unpopular opinion: Matplotlib is a bad library

I work with data using Python a lot. Sometimes, I need to do some visualizations. Sadly, matplotlib is the de-facto standard for visualization. The API of this library is a pain in the ass to work with. I know there are things like Seaborn which make the experience less shitty, but that's only a partial solution and isn't always easily available. Historically, it was built to imitate then-popular Matlab. But I don't like Matlab either and consider it's API and plotting capabilities very inferior to e.g. Wolfram Mathematica. Plus trying to port the already awkward Matlab API to Python made the whole thing double awkward, the whole library overall does not feel very Pythonic.

Please give a me better plotting libary that works seemlessly with Jupyter!

1.1k Upvotes

325 comments sorted by

View all comments

Show parent comment

49

u/PWNY_EVEREADY3 Apr 21 '22

plotnine is a python port of ggplot2 - I've never personally used it, so I would be curious what experienced ggplot users thought of it. But it is there

0

u/[deleted] Apr 21 '22

[deleted] — view deleted comment

26

u/Armaliite Apr 21 '22

1

u/SuspiciousScript Apr 22 '22

This is really cool. The lack of a pipe operator in Pandas makes data munging needlessly tedious.

3

u/LeTristanB Apr 22 '22

There is df.pipe()

1

u/Armaliite Apr 26 '22

I honestly still prefer method chaining. A lot of what makes the tidyverse good is that R uses lazy evaluation. In Python this will always stay awkward.

11

u/Liorithiel Apr 21 '22

R has one feature used a lot in ggplot2 and similar tools, that is impossible to fully reproduce in Python: non-standard evaluation. Basics are mostly fine, but features get more difficult to use in Python while staying still pretty simple in R because of non-standard evaluation. And—heh, this is despite that non-standard evaluation is one of the more criticised features of R!

4

u/madbadanddangerous Apr 21 '22

I need to really give that library a try. My team has a very high bar for adding package dependencies, but if plotnine emulates ggplot well, it could save a ton of time and effort