Hacker News new | past | comments | ask | show | jobs | submit login
Eplot: A new package for making charts in Emacs (ingebrigtsen.no)
254 points by signa11 12 months ago | hide | past | favorite | 43 comments



Neat!

Really clever simplicity on how you added gradients.

This is one of my favorite spaces, so I'll add some generic advice which may or may not be helpful.

I once had the privilege of working for Max Roser and Hannah Ritchie at Our World in Data, as one of the engineers on their Grapher library (https://github.com/owid/owid-grapher), and learned a ton from them (and others on the team) about making great charts.

My one piece of advice from looking at your examples would be: don't neglect title, subtitle, and caption! They would be so easy to do well because you've already created your "simple headers thingies". A few words go along way. Check out "Storytelling with Data" by Cole Nussbaumer Knaflic for a great read on the subject. Owid's Grapher does those the best, IMO (followed closely by DataWrapper.de -- but that's not open source).

At some point, if you keep up with this, you'll also want to add a dataflow library and DSL. Hadley Wickham's dplyr in R was the GOAT, and I copied that in my Ohayo tool and in OWID Grapher's CoreTable library (https://github.com/owid/owid-grapher/tree/master/packages/%4...). Jeffrey Heer's newish Arquero (https://idl.uw.edu/arquero/) library is also along those lines.

Lately I've delving into Mike Bostock's new thing Plot (https://observablehq.com/plot/). So far, excited by it, but only spent a day or two with it at this point.

I don't use emacs anymore, but hopefully something helpful in the comments above.


Thank you for Grapher! I love Our World in Data.


Oh that's why I couldn't find a recent "10% of Emacs bugs fixed": that's what he was working on! Cool stuff. A true Emacs guru.


This looks fantastic! One thought, using Emacs' feature of file- and directory-local variables for the chart config might make for a more flexible UX. (For example, I might be generating the data files and not want to have to manually modify before charting, or I might have a large directory of data files that I'd like to plot at will without having to apply a header by hand to each.)


One could also use Python and matplotlib for plotting in org mode. Gnuplot is not the only thing one can use.


Matplotlib already has a pretty uncomfortable API. I can’t imagine that wrapping that in a layer of elisp would result in anything nice to use at all.

It would probably be a case of the thing OP mentioned, where the amount of code needed would exceed just doing it yourself.


Gnuplot is the best plotting interface I’ve ever used. Once you’ve learned “the Gnuplot language”, it’s very fast and efficient to visualize anything and iterate on it interactively, and I personally find it more usable than GGPlot, Matplotlib, Seaborn, Bokeh, and Matlab.

I think Gnuplot is undervalued because by default the results look horrible. Like many power tools, it requires some config in ~/.gnuplotrc to modernize the looks; http://gnuplotting.org/ is a great source to get started.

Unfortunately, I’m mostly using Matplotlib these days because the data generation is in Python. But despite using it on and off for over a decade, I’m nowhere near my efficiency in Gnuplot, and often have to ask Google or Copilot for help if I’m doing something more complex.


Gnuplot is fantastic. And with the epslatex terminal, it sets the graphics in EPS and the text elements in TeXsobtgat you can get everything typeset juuuuuust right.


To address your python woes: https://github.com/dkogan/gnuplotlib/ Gnuplot is excellent, and I use it every day.


I find Gnuplot syntax to be terse and unintuitive, and having poor discoverability without constantly refer to the docs.


In Gnuplot you can indeed write each command in a very terse way; some simple examples:

    plot cos(x) ls 2, sin(x) ls 3

    plot 'file.dat' u 1:2 w lp lw 3 ps 2
But you can also write the same code in a descriptive way:

    plot cos(x) linestyle 2, sin(x) linestyle 3

    plot 'file.dat' using 1:2 with linespoints linewidth 3 pointsize 2
I think most people prefer the terse version once they learn it. But I’d definitely recommend learning the descriptive commands first, as the abbreviations follow very naturally from there.


You're not wrapping it in elisp. You can just write matplotlib in a code block, evaluate it, and pop out an image to your buffer.


Matplotlib has 2 APIs, a procedural one and an object oriented one. Which one are we talking about? Or both?


Seaborn, plotly, datashader, etc. all exist to wrap matplotlib and they are wildly successful. Is there some reason an equally good interface couldn’t be written in elisp?


One thing that always bothers me with both matplotlib and gnuplot, is that they literally seem to have a command (or function call) for everything. To set the tick size for the third-level ticks on the Y axis, you call set_third_level_y_ticks() or something like that. This is not necessarily bad (and maybe it has to be this way — I haven’t even tried to analyse the problem) but it feels very un-orthogonal, like everything is special-cased.


If you’re looking for something “orthogonal”, you should definitely have a look at GGPlot and its “Grammar of Graphics”.

Personally, I prefer the Gnuplot approach, but I think GGPlot has some cool ideas behind it :)


There is also ESS (Emacs Speaks Statistics) which, among other things, supercharges org-mode with R/Julia, which means the likes of ggplot2 or makie. That said, I do respect any attempt at making something with pure elisp.


You can also use R and it's plotting libraries.


Thats some solid hacking right there. Esp yhe gradient part . Also given that these plots are svg means they can the imported to latex or a web browser. The first option makes it a solid contender for doing plots that need embedding in papers. Congratulations, some good results here.


> Microsoft Github

this is the first time I've seen these two words explicitly put together before, and it made my stomach turn, regardless of how many years it's been true


It’s still baffling to me how many FOSS projects still use that platform, they’ve done very well keeping the ‘Microsoft’ prefix out of people’s sight.

Codeberg does seem to be gaining some momentum with FOSS projects now though, at long last.


Why do FOSS projects use github? Because it's a good product, simple. It has lots of features that people use every day that you don't necessarily find on other source code platforms. For example, their new code search is top class. You won't realize what's missing until you try to do the same thing elsewhere. GitHub also gets a lot of details right e.g. in pull requests and issue management.

Added to that, it has the largest community of developers, and those who would potentially participate in FOSS projects likely already have an account. It's where people already are and what they are familiar with.

(I have contributed to a few FOSS projects on github.)


This ‘everyone is using it so I need to also’ logic is funny to me, given the idea of the F in FOSS is to use network effects to spread the idea of software freedom. Using and thus endorsing a proprietary platform with ever increasing integration into the software lifecycle seems to do the exact opposite of that.


"eat $h*t: a billion flies can't be wrong". (once saw this on a t-shirt) Popularity != quality.


Depends on what you mean by quality. The best complete package probably wins, although that's not the same for everybody.


That isn't the only network you have to model.


The code search is rather meh than top class. Any grep can do better. Also the code search requires one to log in, basically does not exist for not logged in users, which equals zero quality for them.


I don't think any grep would do better on half a billion+ repositories.


FOSS folks need a reality check, regarding of many of their beloved projects are now on the paychecks from Oracle, Microsoft, Oracle, Meta, IBM, Intel, Google, Apple, AMD, NVidia,....

From operating systems, programming languages, frameworks, compilers, editors, whatever.

While placing the code in Codeberg only to get warm feelings.


You have it backwards.

The beloved projects were already successful without those paychecks, hence why those companies took an interest in them in the first place and didn't (at least publicly) try to create their own alternatives knowing that they wouldnt be able to compete.

Since the companies have been in the extend phase of their EEE logic, their contributions to open source have been helpful, granted.


I have been around long enough, hence why I can offer some reality checks.

> 1998: Many major companies such as IBM, Compaq and Oracle announce their support for Linux.

https://en.wikipedia.org/wiki/History_of_Linux

The C language it was written on, has come into existence thanks to AT&T paychecks, landing on Ken Thompson and Brian Kernighan bank accounts.


You omitted:

> 1996: Version 2.0 of the Linux kernel is released. The kernel can now serve several processors at the same time using symmetric multiprocessing (SMP), and thereby becomes a serious alternative for many companies.

Linux had been around for half a decade at that point, and companies took note and reacted accordingly in 1998.


Until 1998 was a toy kernel, that barely worked except in very special cases, as someone that tried to use 1.0.9 with IDE CD-ROMs in 1994, or fighting with X modeline for the graphics card to display a barely working 800x600 in 1996, will recall.

Only after those guys stepped in, it matured to something that would compete with Solaris, during the 2000's dotcom wave.


Ask yourself, why would large multinational corps step in to save a failing product that isn't their own, unless that product was a serious contender that threatened their bottom line.


To outsource development costs.


I don’t understand the proposed reality they (we) should live in.

They are trying to advocate for software that doesn’t hurt its users in a sea of enshittifaction.

They should stop because corporations produce powerful software?


It isn't a matter of proposed reality, rather the fact that somehow bills have to be paid, and all key FOSS projects happen to one way or the other, have developers paid by all big corps that people love to hate.


While this is of course true, there's nothing wrong with lamenting this state of affairs. In an ideal world, this wouldn't be the case, but since it is you might as well do better personally.


Look at all those people getting stuff done on their projects and making consistent releases. What fools! I pity them!


If ‘getting stuff done’ is your only measure of success then fair enough.


Perhaps this is why Github still tries to portray itself as the self-sufficient start-up it once was. I think a lot of independent developers feel like you, and they tend to lean more towards the values of software freedom than shareholder value and big tech capitalism.

I just opened the front page of github.com, Ctrl-F "Microsoft" gives 0 hits.


Exactly my reaction as well. I hope they never rebrand it as MS GitHub.


They'll do the opposite.

"Introducing GitHub Windows 12, coming 2025"




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: