Top
Best
New

Posted by tosh 4 days ago

Plotnine(plotnine.org)
232 points | 68 commentspage 3
MoonWalk 2 hours ago|
Is what?
jpcompartir 11 hours ago||
After plotnine, with a solid & performant (more than the R versions) Python version of Purrr and Dplyr I might never reach for R again!
stared 5 hours ago||
See also Gribouille: A Grammar of Graphics for Typst, discussed here a week ago https://news.ycombinator.com/item?id=48541062.
piqufoh 12 hours ago||
`from plotnine import *`

... I love the idea of a new python plotting library, but why is this anti-pattern so common with plotting libs?

jeroenjanssens 11 hours ago||
While it’s generally considered to be bad practice to import everything into the global namespace, I think it’s fine to do this in an ad-hoc environment such as a notebook as it makes using the many functions plotnine provides more convenient. An additional advantage is that the resulting code more closely resembles the original ggplot2 code. Alternatively, it’s quite common to `import plotnine as p9` and prefix every function with `p9`.

Disclaimer: I made the plotnine homepage and cheatsheet.

setr 6 hours ago|||
The issue I find with this pattern in docs/tutorials is that the prefix makes it very obvious which functions are from this library.

It's particularly worthwhile when looking at the bigger examples that might involve another library, or stdlib functions/libs I haven't dealt with before

clickety_clack 7 hours ago|||
To each his own. Some drawbacks here are that it means that if you want to copy the code in, you have to add all the “p9”s. And, if you want to make a more complicated demo, with maybe a second import, you now have multiple conventions in your demo codebase.
jamessb 12 hours ago|||
> a new python plotting library

Whilst it's still not yet at 1.0.0, it's not that new: the first (0.1.0) release was in 2017: https://pypi.org/project/plotnine/#history

LoganDark 12 hours ago||
matplotlib's first release was in 2003, making it more than twice as old.
teruakohatu 12 hours ago|||
Because most of the time this will be used is not part of a software development project but rather producing publication plots in a script or plots in a notebook. Not what you would want to do when incorporating it into a web app.
lmc 7 hours ago||
Even in a notebook it's a pain... import plotnine as p9 would be nicer.
globular-toast 12 hours ago||
Because it's aimed at data scientists who would rather be using R...
globular-toast 12 hours ago||
Back when I did a lot of data stuff I used ggplot in R because it seemed to be popular, but I was just copy/pasting examples. Then one day I finally started to "get it" and actually read the manual. Learning the grammar of graphics was like a super power. I got to the point I could open pretty much anything people sent me and visualise it in a matter of seconds.

Although I've used Python professionally a lot more than R, I still felt like R was better at this. Somehow opening files in Python always feels a bit more "heavy". I don't really know why, though.

vshulcz 9 hours ago|
[flagged]
jdthedisciple 7 hours ago||
finally a mature matplotlib alternative?
ForceBru 5 hours ago|
Seems like plotnine renders plots using matplotlib and has matplotlib as a dependency: https://github.com/has2k1/plotnine/blob/f6f5cb424f38329c5267...
insane_dreamer 6 hours ago||
How does it handle realtime plotting?
datadrivenangel 5 hours ago||
Plotnine is my favorite python viz package, because ggplot2 is just so good.

Altair and Bokeh are also quite good for interactive graphs, but plotnine is so ergonomic.

wygzy 7 hours ago|
Wonderful!!!