Leather for quick and dirty plots

software #python #leather #plot #dataanalysis #friendica #federation
Estimated time to read: 3 min.
So 03 Juni 2018

The other day, when I installed jupyter notebook on the fresh installed PureOS, I stumbled over Leather. Leather is

the Python charting library for those who need charts now and don’t care if they’re perfect.

as they say in the introduction of the documentation. That sounds nice, and useful for some cases… so I went on and tried something.


As dataset to display, I’ve choosen the numbers from the Federation Statistics page of my Friendica nodes admin panel.

That is the number of nodes and users of the different decentral and federated social networking platforms- As of today that number count is:

  • Friendica (324/12475)
  • diaspora (253/672478)
  • red (13/82)
  • hubzilla (183/3680)
  • GNU Social (187/18187)
  • StatusNet (11/71)
  • Mastodon (2049/767309)
  • pleroma (166/1727)
  • socialhome (3/541)
  • ganggo (1/92).

The numbers in the brackets are number of nodes known and their total accout number. These numbers are (a) not representative for the enire network and (b) no measurement of active users. Please note, that the numbers for GNU social also contains the postActiv nodes and their users.

So what I wanted to have is a quick and dirty plot for these numbers (see the code below). Eventhough we have pretty graphs in the admin panel and on external pages like for instance The Federation.

Two things I really liiked. The easy on how to extract the data points from the data structure. They have a nice list of examples with different file readers, explaining the conceps. And that the output format is (only) SVG, making the graph easy to scale.

One could start playing around with styling the result. But at this point I’ll stick with the result, after all it is supposed to be done quick and dirty.

So lether is a really nice plotting library for quick view on data.

The Code

Nothing fancy. Quick and dirty, straight forwart to get the plots.

# we use leather as library for plottong stuff
import leather
# and the plot for the account number should be logarithmic to the base 10
from math import log10 as log

# define the data to display, they are taken from my Friendica nodes admin panel
data = [
    { "x": "Friendica", "y": [324, 12473] },
    { "x": "diaspora", "y": [253, 672493] },
    { "x": "red", "y": [13, 82] },
    { "x": "hubzilla", "y": [183, 3681] },
    { "x": "GNU Social", "y": [187, 18187] },
    { "x": "StatusNet", "y": [11, 71] },
    { "x": "Mastodon", "y": [2049, 767280] },
    { "x": "pleroma", "y": [166, 1727] },
    { "x": "socialhome", "y": [3, 541] },
    { "x": "ganggo", "y": [1, 92] }

# due the data structure we need ledger accessor function to determine the
# X and Y values of a row
def x(row, index):
    return row["x"]
def y1(row, index):
    return row["y"][0]
def y2(row, index):
    return log(row["y"][1]

# plot 2 bar charts, one for the node number, one for the user number
chart = leather.Chart('Number of Node by platform')
chart.add_bars(data, x=y1, y=x)
chart = leather.Chart('Number of Accounts by platform (logarithmic scale)')
chart.add_bars(data, x=y2, y=x)

And here are the resulting plots, though I used GIMP to convert the SVG files.

number of nodes by plattform

number of accounts by plattform, logarithmic scale

theme last update

november 2017


Unless otherwhise noted the contents of this homepage are governed by a Creative Commins license (CC-BY) that essentially means you may use my content to remix it into your work but name me.


You can send me an email to tobiasdiekershoff.net or see the imprint for further contacts channels.

Made with

Powered by Pelican. Theme inspired by Bootply using the Sandstone color schema.