Live data from Hacker News

Gnuplotlib: A gnuplot-based plotting backend for NumPy

github.com

61–69 of 69 posts

Re: Gnuplotlib: A gnuplot-based plotting backend for NumPy

#61
post #24

Earlier quoted context omitted.

from matplotlib import pyplot as plt WTF? Broken from right there. What's a plt? "o" key broken? Why didn't they just call it pyplot? Why not just import pyplot pyplot.plot(lambda x: math.sin(x)) pyplot.plot(x=[0,1,2],y=[0,2,4])

The library is not forcing you to use plt as a shorthand. Nothing is stopping you from calling from matplotlib import pyplot pyplot.plot([0,1,2], [0,2,4])

Yeah I know. It's just that they've created an ecosystem of "plt" and that makes me want to use the entire library less.

Re: Gnuplotlib: A gnuplot-based plotting backend for NumPy

#62

I might have missed the memo where Gnuplot has a better api than matplot ;) Seriously though, there have been many attempts to make a "better matplotlib" and yet it's still going strong - mostly because when you really get into scientific plotting and need print quality plots or embed plots in an GUI with very specific parameters it's hard to beat. Sometimes you just need to place a label in a specific spot and that'…

I also have difficulties with Gnuplot and Matplotlib. I like Vega [1] that allows me to create visualisations in a declarative way. If I really need something special I go with d3.js, which had a really steep learning curve but with ChatGPT it should have become easier for beginners.

[1] https://vega.github.io/vega-lite/

Re: Gnuplotlib: A gnuplot-based plotting backend for NumPy

#63

I've found Lets-Plots [0] to my least painful plotting option for Python so far. I'm so used to the grammar of graphics from ggplot, especially compared to plotting in matplotlib or seaborn. 0: https://lets-plot.org/

Interesting. It seems the major difference with plotnine is that lets-plot is implemented in Kotlin and the Python package uses a Python-Kotlin bridge. Both lets-plot and plotnine are available under the MIT license.

It looks like lets-plot does not implement the ggplot2 theme interface yet, unlike plotnine which is 99.99% compatible with ggplot2. On the other hand lets-plot also includes additional geospatial functionality on top of basic ggplot2 compatibility.

Re: Gnuplotlib: A gnuplot-based plotting backend for NumPy

#64
post #27
post #15

Just a comment for the repo owners: insert images for each code example!

The docs link to the "guide" right at the top. This has basic usage examples and images: https://github.com/dkogan/gnuplotlib/blob/master/guide/guide...

The landing page (readme, in the case of GitHub repos) is way too important. Even a one-click barrier to an examples page obscures the information unacceptably. UX principles also apply to documentation.

Re: Gnuplotlib: A gnuplot-based plotting backend for NumPy

#65
post #64
post #27

Earlier quoted context omitted.

The docs link to the "guide" right at the top. This has basic usage examples and images: https://github.com/dkogan/gnuplotlib/blob/master/guide/guide...

The landing page (readme, in the case of GitHub repos) is way too important. Even a one-click barrier to an examples page obscures the information unacceptably. UX principles also apply to documentation.

Yep. There's a reason for the way I did it, but clearly I need to change it. Thanks for looking.

Re: Gnuplotlib: A gnuplot-based plotting backend for NumPy

#66
post #63

I've found Lets-Plots [0] to my least painful plotting option for Python so far. I'm so used to the grammar of graphics from ggplot, especially compared to plotting in matplotlib or seaborn. 0: https://lets-plot.org/

Interesting. It seems the major difference with plotnine is that lets-plot is implemented in Kotlin and the Python package uses a Python-Kotlin bridge. Both lets-plot and plotnine are available under the MIT license. It looks like lets-plot does not implement the ggplot2 theme interface yet, unlike plotnine which is 99.99% compatible with ggplot2. On the other hand lets-plot also includes additional geospatial functi…

Lets-plot does implement theme and more - flavors (i.e. color profiles) take a look: https://lets-plot.org/pages/charts.html#presentation-options...

Re: Gnuplotlib: A gnuplot-based plotting backend for NumPy

#67
post #63

Earlier quoted context omitted.

Interesting. It seems the major difference with plotnine is that lets-plot is implemented in Kotlin and the Python package uses a Python-Kotlin bridge. Both lets-plot and plotnine are available under the MIT license. It looks like lets-plot does not implement the ggplot2 theme interface yet, unlike plotnine which is 99.99% compatible with ggplot2. On the other hand lets-plot also includes additional geospatial functi…

Lets-plot does implement theme and more - flavors (i.e. color profiles) take a look: https://lets-plot.org/pages/charts.html#presentation-options...

Ok, thanks - not sure how I missed that. I guess the conclusion is that we now have two pretty much complete reimplementations of ggplot2 available in Python.

Re: Gnuplotlib: A gnuplot-based plotting backend for NumPy

#68

Earlier quoted context omitted.

Matplotlib is what is wrong with matplotlib.. Broadly, the problem is that its syntax was meant to reflect that of Matlab, which, I guess, makes it intuitive for Matlab users. For the rest of us, it's mostly unintuitive and inconsistent.

Can you give an example of its inconsistency? I would be genuinely interested what are the inconsistency from a Python-perspective. I am former Matlab/Octave user. To me the julia interface of matplotlib is actually quite nice to use, but unfortunately the installation is a bit brittle.

From the top of my head, the one that annoys me regularly is the difference between setting a title/x or range on plot, and on a subplot. So plot.title(), and ax.set_title().

By the way, who came up with the idea that an axis object is a great handle to handle subplot settings..?

Re: Gnuplotlib: A gnuplot-based plotting backend for NumPy

#69
post #16

Earlier quoted context omitted.

I see the potential long term but that api is unintuitive at best. It almost seems obstructively terse. (ggplot(mtcars, aes("wt", "mpg", color="factor(gear)")) + geom_point() + stat_smooth(method="lm") + facet_wrap("~gear")) From https://github.com/has2k1/plotnine , their front page examples. I get that it's ripping off the ggplot api, but why would they not alias "aes" to something more meaningful? It stands for "ae…

As who hadn't seriously used any plotting library, some of my questions: - Why isn't the first term `ggplot(mtcars, "wt", "mpg", color="factor(gear)")` instead? It seems that the second argument always has to be a `plotnine.mapping.aes(...)` call or a saved `aes` value. It is not really hard to distinguish `ggplot(data, saved_aes)` from `ggplot(data, "x-col", "y-col", ...)`. The only issue might be the third `environ…

best by far != perfect
Post reply on HN