Join the discussion

Write your take first — we'll ask for email only when you're ready to publish.

  • Hacker News
  • matplotlib 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.)

  • It 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.

  • And 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...

  • I'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!

  • This is definitely one of the better Python plotting libraries out there, but no matter which one I use, they make me yearn for R.

    The R language is just so much more beautiful than Python, in its full lispy goodness, with lazy evaluation.

    It doesn't matter quite as much now that I have LLMs write a good chunk of the plotting code. But the LLM python plotting code is easily 5x-10x as many lines as a hand-crafted R plot, making it slower and harder to grok than R.

  • Hey! 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 :)

  • Plotnine 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.

  • If 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.

Explore Birbla archives