logoalt Hacker News

jstanleytoday at 8:20 AM2 repliesview on HN

Using operator overloading of "+" to configure the plot is... a choice.


Replies

jamessbtoday at 8:31 AM

Plotnine is heavily inspired by the ggplot2 library, which uses the + operator in the same way: https://ggplot2.tidyverse.org/#usage

bittumenEntitytoday at 11:48 AM

It is! And that's kinda the point.

Like others mention, this is inspired by ggplot2, a Grammar of Graphics library. The whole idea is graphics are composed by adding "layers", not like layers on a canvas, but like pouring paint into a pot, then the library understands the content and paints it to the canvas.

Layers might be pure data, geometry (lines, points, ...), annotations, styles, axis, etc.

When you get familiar with it, it's much more natural way of describing plots, better composition and easier exploration

show 2 replies