Plotnine
- closed - 10933 sekunder sedanHey! I worked on the plotnine guide (https://plotnine.org/guide/). Always interested to hear what people find hard to understand about plotnine, or what they wish there were more of (e.g. examples, guide pages, api reference docs).
(Both has2k1 and I work for Posit, which supports plotnine work, but authoring its guide was mostly an act of passion for me :)
- has2k1 - 29325 sekunder sedanIf you already use plotnine, or if this has piqued your interest, the next release (v0.16.0) will bring nice capabilities.
You can get a sneak peek by installing the pre-release:
pip install --pre plotnine
Details here: https://github.com/has2k1/plotnine/issues/1031
Disclaimer: I'm the author.
- seanhunter - 20141 sekunder sedanPlotnine has been great in my usage, but I see violin plots on the front page. Just say no to violin plots.
In almost any situation you either want to talk about the actual distribution (in which case plotting the distribution on one side of the line arranged horizontally is significantly superior to plotting it vertically on both sides of the line for some reason as a violin plot does[1]) or you want to talk about the quartiles etc in which case a boxplot is better.
A violin plot tries to do both and as a result does them both badly.
Extended anti-violin plot rant here https://www.youtube.com/watch?v=_0QMKFzW9fw
[1] I remember in one meeting before I knew better, producing some violin plots and putting them on a slide and I knew I had gone wrong when that slide came up and everyone in the room had this confused expression on their faces and was leaning their head over to the side to try to see the distribution better. When your visualization produces obvious confusion like that, you can be completely certain it has failed.
- fifilura - 7207 sekunder sedanIt is great, but I have completely given up non-interactive plots since a while.
You get so much more information in plots using bokeh (or I assume plotly).
Tooltips, zooming, interaction.
And the LLM helps a lot when the plot is a bit more complex.
- williamcotton - 21584 sekunder sedanI've always liked the ggplot2 and the Grammar of Graphics approach to plotting so much so that I wrote my own DSL based on it - it is standalone, written in Rust, has WASM bindings (as you can see on the website) and more:
https://williamcotton.github.io/algraf
It pairs well with a related data translation DSL:
https://williamcotton.github.io/pdl
And you can see the two working together here:
https://williamcotton.github.io/datafarm-studio
There's LSPs for both, LSP clients for VS Code, and even language diagnostics for standalone Monaco editors in the browser.
Of note is that the same language diagnostics are exposed via the WASM as via the LSP interface allowing for the same friendly red squiggles to look and work the same in both your browser with Monaco and your editor with the LSP!
- lacoolj - 5835 sekunder sedanIf this was for JS and not Python I would be all over it for the upcoming NFL/NBA seasons and my stat visualizations
- kasperset - 14882 sekunder sedanWhile it is good to have plotnine for python but ggplot2 in R has this whole ecosystem of packages/extensions that augment the ggplot2 such as ggalluvial, ggrepel. More at this link https://exts.ggplot2.tidyverse.org/gallery/ This would make it really compelling to tip my toes in the Python world. Regardless, I am liking this "ggplotification" of python. All we need is more "tidification" of Python data frame world.
- qrobit - 34584 sekunder sedanAnd it comes with tidyverse-like cheatsheet[1] that I confused with ggplot2 when first discovered plotnine
[1]: https://github.com/rstudio/cheatsheets/blob/main/plotnine.pd...
- icarusz - 13629 sekunder sedanmatplotlib is what most folks reach for by default, but I'd argue that's habit and popularity talking, not a real fit advantage. For a lot of plotting work, the grammar-of-graphics libraries — Altair, plotnine — may be the better tool for many people (and Agents); they just don't have the muscle memory behind them.
(Disclosure: I'm at Posit, which supports plotnine.)
- skimmed - 19793 sekunder sedanNice package! A side-by-side comparison with seaborn would be very nice to see.
- a_ba - 27022 sekunder sedanI have used neither in quite a while now but there is an alternative from jetbrains that i started using because it shares the same ergonomics and had better (?) documentation.
- pwillia7 - 20503 sekunder sedanVery cool will have to check this out more.
Semi related -- I made a little d3.js AI wrapper that works pretty well for making quick charts -- https://prompt2chart.com/share/e998a3f6-9482-4c18-931f-a4513...; https://prompt2chart.com/;
- persedes - 13735 sekunder sedanLove plotnine when I switched over to python and great to see the project develop! But I have to admit I ended up switching to altair after all which has been my go to in python now.
- CuriouslyC - 9571 sekunder sedanIs the selling point for this vs e.g. Plotly just the ggplot style semantics?
- vlad-asis - 20788 sekunder sedanI always like to see Hadley Wickam’s masterpiece frameworks emerging around.
- quincymac - 24427 sekunder sedanNice one. I'm aware of plotnine because ggplot is more intuitive IMHO than say matplotlib.
2 things that would be awesome are interactive plots (hover + text box) and chlorpleth (tiled map) plots.
On closer look you have already nailed the latter!
- domoritz - 36312 sekunder sedanFor another grammar-of-graphics-based visualization library (flexibly compose charts rather than simply pick a template), check out Altair https://altair-viz.github.io.
- stared - 12160 sekunder sedanSee also Gribouille: A Grammar of Graphics for Typst, discussed here a week ago https://news.ycombinator.com/item?id=48541062.
- jpcompartir - 31208 sekunder sedanAfter plotnine, with a solid & performant (more than the R versions) Python version of Purrr and Dplyr I might never reach for R again!
- piqufoh - 36119 sekunder sedan`from plotnine import *`
... I love the idea of a new python plotting library, but why is this anti-pattern so common with plotting libs?
- jstanley - 37043 sekunder sedanUsing operator overloading of "+" to configure the plot is... a choice.
- globular-toast - 35964 sekunder sedanBack 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.
- insane_dreamer - 12375 sekunder sedanHow does it handle realtime plotting?
- datadrivenangel - 12238 sekunder sedanPlotnine 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.
- jdthedisciple - 16070 sekunder sedanfinally a mature matplotlib alternative?
- wygzy - 18169 sekunder sedanWonderful!!!
Nördnytt! 🤓