Another little JSON-consuming CLI tool. I wanted an easy way to draw basic plots (line & bar charts) of JSON data in the terminal, and found the following tools:
gnuplot
(too complex for my usecase, no JSON) / the eplot
wrapper (ruby dependency, still no JSON)I wasn’t 100% happy with any of those. You can generate CSV with jq (jq '"\(.x),\(.y)"'
), but this is tedious to type. So, I wrote jp
. Primarily because it would be fun to write it (but also because it seems useful). It has the features and “ui” I wanted:
For example, if I want to plot all Foo
keys against all Bar
keys, I can write jp -x ..Foo -y ..Bar
. Any other pre-processing is delegated to jq
.
On a personal note, I am growing rather fond of JSON-in-the-shell. It’s a bit like PowerShell but less demanding.
I have been informed that “actually decent” plots are provided by a Julia package UnicodePlots. They do indeed look rather neat, so until
jp
gets there,UnicodePlots
does make better plots :)That was a rude comment, don’t take it personally, it looks great.
this is awesome!
Thanks for the kind words, glad you like it!
Ha, nice! I was recently looking for a tool that could plot on the CLI as well. I came across bashplotlib but failed at Googling and didn’t find the others mentioned on this page and I fell back to gnuplot’s term mode.
I’ve always liked CLI tools although I use GUIs as well, but I’ve come to realize that the CLI is not something to be superseded by GUIs. They are different ways of interfacing with a computer and can exists side-by-side and so I’m happy to see new tools being created for it.
I recently found https://github.com/rs/jplot which isn’t limited to using characters, but is limited to iTerm2. You also might want to check out the https://github.com/gizak/termui library for inspiration on how to do higher resolution plots.