I’ve been using Ledger CLI for a year now. It’s really a feature-rich command-line double-entry accounting tool, but the only one thing missed is data visualization. Although Ledger has a report script, it’s not very useful for me and the default output of Gnuplot is ugly. So I spent some time digging into Gnuplot and made 6 scripts based on Ledger’s original one.
This is a typical graph for comparing total income and expenses of every month. I set the amount format of income to absolute value so it can appear on the Y axis as expenses side by side for easy comparison.
This script will plot a monthly histogram of any account we specify. When executing, an account name must be followed as parameter. For example, if
Expenses:Eating is followed, the script will show us how much we spent on Eating in every month.
This script will plot a histogram of any account we specify, not monthly, but with sub accounts. When executing, account name and/or period shall be followed as parameter. For example, if followed by
Expenses -p oct, the script will show us what exactly took our money in October, from the most to the least.
We can see how our Income and Expenses grow throughout the year with this script. If the gap between goes bigger, means we’re getting more wealthy. If the gap goes smaller, we should really pay good attention to it.
This script helps us to see how our Assets and Liabilities change throughout the year. The gap between represents net wealth. It’s a good thing to see the gap goes bigger.
As you can see the graph is a little complicated, the X axis lists all the expenses, Y axis is amount accumulated month by month. Every line represents the total amount until that month. The script require a Haskell reimplementation of Leger - hledger, in order to work.
I don’t konw how to describe it appropriately, as it shows every month’s detailed expenses, so I name it Mega Expenses. It’s a clutter to see as is, but when using an interactive terminal, reveal month by month, we are able to figure out some unusual expenses that jump too high than previous steps.
First, all scripts assume that the default account names are Income, Expenses, Assets, Liabilities. If yours are not, change them accordingly.
Second, all scripts assume journal files keep in a yearly basis, i.e. every year’s journal should be a separate file. There’s no restrictions on reporting period, you may need to add some parameters to restrict the output to a specific period.
Third, multi-currency is not taking into consideration. If you have multi-currency, amend the scripts and add parameters just like you would do with Ledger.