A New Package for Making Charts in Emacs: eplot

One of the items on my todo list was:

And that’s because I’ve been looking for an easy way to do simple plots for yonks. When I did a post about movie ratings, I tried chart.el:

It’s a built-in thing in Emacs that has its origins as a testing tool for eieio, and as such, it is pretty limited. But it basically did what I needed? Except for… man, look at that Y axis. This cannot stand!

Bad axes marking is a personal bugaboo — I hate them sooo much! But it’s easy to understand how they end up that way, because it’s a genuinely tricky problem.

For instance, for decades Google Finance had charts looking like this, with totally nonsensical axes.

They basically just use the largest number as the highest Y marking, and then add a couple lines equidistant towards origo, and then go off and collect their paychecks.

These useless charts were there until, I think, 2021? I used to check them irregularly for years to see whether they’d gotten sufficiently embarrassed by this shameful thing, but nope. But then they reimplemented the entire site, and they finally got proper axes.

I was particularly interested because I worked for a stock broker, and one of the first things I did (back in 1997-ish) was implementing a chart library:

And the problem isn’t exactly “hard” in a “solve for Eulers dilemma” maths way, but it just requires some thought about what “pleasing numbers” are (basically 1, 2 and 5 in various scales), and thoughtful handling of the many border cases you get when plotting stock charts (a range can be between $0.00001 and $0.00002, or between 1e9 and 1e10 etc etc), and how do to time periods (years, sure, but then half years and then quarters and months and weeks? and then possibly divide months into weeks? so many details).

So why didn’t I just use this PHP thing for my charts? Well, while it’s really convenient to generate stuff on a web server — that’s not really very convenient when you’re futzing around in Emacs with some numbers. There’s a reason Excel and Jiputer Notebooks are so popular, after all — interactively massaging the data until it shows what you want it to show is where it’s at. I mean, giving others an optimal experience of the data.

Now, of course Org has functions for doing plots, but… it uses Gnuplot as the backend, and I’ve never enjoyed how Gnuplot does anything:

Again, look at that Y axis and roll your eyes. I mean, it’s chosen nice numbers for the axis, but the formatting?

I mean, Gnuplot is perfectly OK, but…

But mainly, I had a stomach bug thing, so I didn’t really have anything to do, so I decided to type up this thing anyway. So:

Look! The Y axis! It has numbers that make sense!

And… I wasn’t really going to implement everything from chart.php, but when I got started, it was just irresistible to do everything.

But also more, like “dark mode”.

One fun thing in the PHP library are the gradients, which were painstakingly written by hand (including a GIF colour map resource thing, if I remember correctly). So they were painted pixel by pixel, I think? But in the Emacs Lisp version, I just use SVG, and SVG has support for gradients. So I just make a polygon and gradient that (as shown above).

And here’s the PHP original. Looks pretty similar?

Just about the only thing I didn’t implement was this other, weird gradient, because… er… well, it would be hard! I’d have to re-implement the pixel by pixel thing… or at least line by line thing, and that would involve math and stuff.

But it’s not like anybody would use that…

But it does look nice in the backgrounds? *sigh* Nah, not gonna implement it.

So what does the Emacs user interface for this look like?

You go to a buffer with a lot of numbers in, and you type M-x eplot. (Yes, I had to call the thing eplot, since chart was taken.)

It’ll then pop up a buffer and show the plot.

But how do you then adjust the plot? After all, the point of all this is that it should be easy to tweak plots until you get what you want, so…

To digress a bit — sometimes I happen upon what seems to be nice libraries (or frameworks, as they often call themselves), and the selling point is often “we do all the boring stuff for you! Things just work!” And then they present a minimal example, like I’ve done here, and then they sort of leave it hanging how you do the rest.

So when you google that, you discover that if you want to change any of the defaults, you have to write a depth-first traversal algorithm (in Haskell), and then override all of the stuff everywhere, and then you end up with 4x as much code as if you’d just written the darn thing yourself the way you wanted it.

That is: Many frameworks seem to actually have the motto “we make the simple things trivial, and then the slightly more difficult things almost impossible”.

So — I hope I haven’t landed there myself?

OK, the first “extra” thing I did was introduce the concept of “headers”, like this:

I’m using a compact format with a small chart, just as a demonstration here — don’t need all that scrolling on the blog here.

And that’s basically it — most of the different variations you see in the very first image on this blog post are by these simple headers thingies.

All the useful things can be controlled by these headers, so iterating through this stuff is fast — just add some headers and C-c C-c and then you immediately see the results. (Yes, there’s an eplot mode to make this easier.)

Yada yada. I’ve even written a README.md file that documents all the various possibilities.

This is still very much a work in progress, but I’ve put it on Microsoft Github. I think it should basically be somewhat useful now, but I’ve been hacking away at this for a week now, and I keep redoing everything, so perhaps not? In any case, the code is a complete mess now as I’ve been programming it test case by test case, in the least efficient way possible, and I need to consolidate a lot of code paths, and make the code more readable.

But I feel like taking a break now, so I just pushed it. So there. Caveat end userage.

Comics Daze

I really should be doing other things today (I’m in the middle of writing a Brand New And Exciting Package For Emacs), but look what I got in the mail yesterday:

Yes! I big whopping box of comics from Domino Books! I’ve been slacking off on buying small press comics lately — mostly just because I’ve been buying all this other stuff, so I did some Extreme Shopping last week.

And! I also got other comics yesterday, so it’s time to do some mixed reading.

Various: Outer Spaceways Incorporated: Kronos Quartet & Friends Meet Sun Ra

09:33: Isolated Comments/A brief yet rambling journey through a bunch of country style quote and bits of worthless advise by Jonathan Petersen (Colour Code)

And I also bought a new lens for my camera I’m using here on the couch — the conditions aren’t ideal for snapping pics (somewhat low light, but it’s handheld so I can’t do longer exposures, and I’m holding the comics at an angle usually, so can’t use a big aperture, and the colour temperature of the lamps is much redder than the daylight in the background), so I’m trying to use a 20mm lens that I can stick closer to the comics… We’ll see.

Hm, I think this lens might indeed work well… Even if the angles aren’t quite right. I mean, it’s got a fish eye lens quality going on here. But whatevs.

Wow, this artwork is impressively obsessive. It’s cool.

The bigger book is a collection of one-page strips, many of which feature aphorisms or absurd statements. It’s fun.

And the smaller book is also like that, but with red ink. And here he poses one of the eternal questions.

Caroline Shaw & Sō Percussion: Rectangles and Circumstance

09:57: Ljubav, Optor &td – Love, Resist etc by Ivana Armanini

This is a collection of mostly short pieces from this Croatian artist — mostly single page strips.

And the graphics are really intriguing — the pieces often seem to be narrative without it being quite clear what the narrative is. It’s interesting.

But perhaps the more overtly polemical pieces are less compelling? But they’re fun.

Gastr Del Sol: We Have Dozens Of Titles

10:20: Tokyo These Days 1 by Taiyo Matsumoto (Viz)

Abhay Khosla was talking about this the other week, so I bought the two first volumes. (And they say that viral marketing doesn’t work!)

This starts off with an comics editor leaving the business…

… even considering selling off all of his comics! It cannot be!

And indeed, it cannot be — the story then takes a u-turn where the editor decides to self publish a new anthology, featuring all of his favourite old comics artists.

OK, I was just gonna read the first volume, but it was a brisk read, so…

It’s really good? I mean, there’s a lot of really nice little scenes like this…

… but it’s a bit disappointing that the storyline sort of dissolves. Well, OK, the main story about the editor collecting contributors for his anthology as if they were Pokémon wasn’t all that interesting in itself, so it’s understandable how the book spends more and more time with individual comics creators instead of the editor, but it all feels rather aimless.

But like I said, each individual scene is really good — wonderful storytelling and solid artwork. The final volume is being published in September.

11:57: Yaw Pitch Roll by Rodger Binyone (No-Man Press)

Is this screenprinted? At least the cover?

The insides are a mix of (I’m guessing) screenprint, riso and inkjet? Perhaps?

Anyway, looks great. And it’s funny.

Beth Gibbons: Lives Outgrown

12:05: Infinite Wheat Paste volume 1 by L. Pidge (Avery Hill)

Hm, OK, this art style isn’t really my thing.

And er…

… uhm, ah, OK, the storytelling is just choppy as hell? I’m not really sure what’s going on at any point, but it’s not a productive confusion — it’s more like gazing on some in-joke I’m not part of.

And even if they’ve worked hard at making the characters have visually distinct designs, I still having a hard time telling them apart? Weird.

So I guess this just isn’t for me, and I ditched it after about 40 pages.

And now I’m taking a nap.

John Cale: Caribbean Sunset

15:05: Komikaze #22 edited by Ivana Armanini

I’m awake! I’m awake!

This is a Croatian anthology, I think, but mostly with English text. (And with subtitles at the bottom of the pages.)

It’s mostly very short pieces, but with some longer ones — it’s a nice mix that way, but doesn’t have much cohesion as a book. But there’s several good pieces, like the above.

Some absurd stuff.

And some jokey stuff.

I think I’ve read a few previous Komikaze issues before, but a long time ago? And it’s nice to see that they’re still going.

The weather outside turned lovely while I was napping, so perhaps I should pop out for a walk and get some takeaway…

Adult Jazz: So Sorry So Slow

17:09: Balladen on Yano Young-Star by Jacob Thubo (Forlaget Fabel)

This is a pretty traditional western — but for some reasons, there are elves and orcs? They behave exactly like humans, so it doesn’t really make a difference much.

Perhaps the most outré fantasy element are all these low-rise pants.

It’s a very odd book in that it’s a totally traditional, well-paced and well told western… but then it just ends on the most jarring, nihilistic note ever. Very strange. If I were to guess, I think the author just lost interest in the storyline? But perhaps it was planned that way from the start as an ultimate downer story.

17:18: Tales from the Richy Vegas Psychoverse by Richard Alexander

I think I’ve read the first issue of this before?

But wow, this is unique. So we’ve got the guy below narrating this (I guess) autobio, and the parts of the action in the circle above that he’s looking at is the reading order — from the upper right hand corner and around the circle.

And it works! It’s absolutely hypnotic.

These are very compelling reads. The way these stories are told make them much more dynamic than they’d be laid out in a traditional way. It’s propulsive in a way, the way you have to let your eyes skip up and down and around.

Wonderful stuff.

David Bowie: Divine Symmetry (3): BBC Radio Sessions and Live

17:37: Walking Distance by Lizzy Stewart (Avery Hill)

Yes! I love watching people walking around in cities in movies.

This is a very smart little book — it’s interesting, and it’s strangely affecting. And lovely artwork.

17:59: Second Hand Love by Yamada Murasaki (Drawn & Quarterly)

This book collects two stories. The first is composed of five-page characters, and it wasn’t really obvious at first that it was a continuous story instead of a series of vignettes over the same theme.

It’s about having an affair with a man, and it ends in the most conventional way imaginable.

I like the pensive atmosphere, but it doesn’t really say anything new or interesting.

And whatever impact the first story may have had, it’s diluted by including a shorter story at the end — and the shorter story is about exactly the same thing as the long story, so I’m sitting here going “yes, I know! we’ve already been over this!” My guess is that they felt that 160 pages would be too slim for a book in the US bookstore market, so…

(The second story does have a better ending, though.)

Machinedrum: 3for82

18:46: Jaywalk #3 edited by Floyd Tangeman & Austin English (Domino Books)

Always great to get a new Tangeman anthology…

Whoa. That’s impressive.

It’s an excellent anthology — it seems to have a kinda unified mood going on. And it has more Richard Alexander.

Toshimaru Nakamura: Culvert: No-Input Mixing Board 10

19:08: Johnny Viable by Steve Aylett (Floating World Comics)

Hm, have I read this before? It looks really familiar now that I’m holding it in my hands. (I have Online Shopping Aphasia — I never recognise a comic book when I’m shopping online.)

This is hilarious. As usual, it’s panels from old comics repurposed with a new text, and it works brilliantly.

Some of the pieces veer more into abstraction, though, which isn’t as funny.

But it’s mostly bangers.

Meat Beat Manifesto & Merzbow: Extinct

20:20: Safer Places by Kit Anderson (Avery Hill)

Hey, lots of Avery Hill today…

Huh, this looks extremely familiar… Oh, this piece was printed in a mini earlier. I guess this is a collection of shorter pieces, then?

Yes, I’ve read many of these before, but that’s OK. There’s a number of different styles, but they all have this wistful longing quality to them.

So it feels like a proper book, and not just a collection of random pieces.

It’s very good.

James White: James White’s Flaming Demonics

20:49: The End

And now I think I’ve read enough comics for today. And… I’ve now discovered that my camera has a lens distortion correction thing that I can switch on! *doh*! So the next Comics Daze should be less fish-eyed.

A Super Simple Todo Package For Emacs

I’m a really good procrastinator. I can walk past the stereo’s dangling speaker cables for years and tell myself each and every time “I should fix those” and then not think about it until the next time I walk past the stereo. Which is half an hour later.

As an experiment this year, I thought I could try just to jot down all these minor jobs (as well as more important things) in a todo list and see whether that would spur me into doing these things… and the answer is, amazingly enough, yes indeed.

Just look! The speaker cables are no longer dangling randomly! (Take my word for it — it was annoying.)

The .txt file I’ve been using tells me I’ve tackled 141 different tasks, from the major to the really trivial. That’s like, er, 14000% more things than usual! At least!

Now, Having things in a .txt file certainly works, but it’s so… basic. So I thought about Org mode and then I thought uhm perhaps not today. And then I googled “emacs todo mode”, and got this:

Did you just tell me to go fuck myself, Mr. Todo Manual? I think you just did.

I looked into a couple other projects, and they all seemed to be more geared towards facilitating further procrastination — by arranging todo items in all kinds of weird hierarchies, assigning priorities and so on. So you can spend hours making The Perfectly Ranked Todo List instead of actually getting shit done.

So one of my todo items was to write a new, trivial todo package: One that allows you to enter/view/edit items, as well as assigning a handful of statuses, like “done” and “in progress”.

And then nothing much more, really.

I’m a bit under the weather today, so I’ve now found time to write that package, and I’ve put it on Microsoft Github.

It’s not like I’m super-procrastinating about other things by writing a tool to help with procrastination. It’s not like that at all! For heaven’s sake!

But here’s the entire manual on how to use it:

Type M-x anddo RET.

That’s a bit shorter than the todo-mode manual, eh? Eh?

One think I’m not quite sure about is how to display longer todo items… Yeah, you can type in as much text as you want per item, but the listing only shows the first line (the “subject”). But with an arrow showing you that there’s more, and you can display that with RET. But it seems a bit unsatisfying…

Anyway! Now I’ve done… 142 items from the todo list!

Have Anybody Made Their Best Album After 33?

Every time an older pop/rock musician comes out with a new album, the reviews are always “this is the best album they’ve made since that album that was actually good several decades ago” (and then two months later, nobody ever listens to the new album ever again).

So I’ve been idly wondering whether there is a pop/rock artist that has ever actually created their best album ever after they’re 33 — I couldn’t think of anybody offhand.

Data science to the rescue!

Now, note that I didn’t say “created a good album” or “wrote some good songs”, because that happens all the time. But their best album?

And, sure, it’s all subjective blah blah blah, but surely nobody reasonable would say that I/O is Peter Gabriel’s best album. Surely! There must be some sanity in the world!

So I picked a couple dozen artists that have had long careers, and plotted their albums in the chart above. The ones that somebody reasonably could call “their best” are marked in green. When it’s a band, I’ve picked the “main songwriter”, but bands are usually more or less the same age, so it doesn’t matter that much.

And… my intuition was basically kinda correct: The vast majority of what can be considered “best albums” are done before the age of 33. But there’s some outliers, like Pet Shop Boys, Kate Bush and Kraftwerk.

[Edit: The chart above isn’t the original — I’ve added a few more “conceivable bests” after protests, but it doesn’t change much on the whole.]

For jazz performers and contemporary composers, I think the productive career is often longer? I don’t really have a theory as to why older pop musicians stop writing banging tracks, but my guess is that they get so good at stitching together reasonably OK-sounding songs that they stop experimenting — and if you don’t experiment, you don’t fail or stumble upon new, cool tunes.

I’ve put the data on Microsoft Github, and I got the data from discogs… which reminds me that I should do some whinging about discogs:

So Eurythmics have done 27 albums? Really? Yes, because they include all effluvia like “BBC Rock Hour #434 (Version “A”)” in the “album” section, so even if they’ve really only done, like, ten albums, you get all this junk.

I’ve tried to edit out the junk, so I may have missed some, or edited too much, but it doesn’t really make that much difference to my extremely scientific approach here.

Did you know that The Beatles released 174 albums? Not many people do.

(And also: Nyah, nyah, Betteridge’s law.)