XKCD style plots

I’m a frequent user of the xkcd R package which allows you to make plots like the ones you see in xkcd. Has anyone tried to make a theme like that for Makie or any other plotting package? A quick duck duck go search would suggest not, but I thought I’d check here too.

PyPlot.jl and PythonPlot.jl provide an interface to matplotlib.pyplot, and that library apparently has an xkcd function to plot in this style.
Source 1
Source 2

Cairomakie doesn’t have it, but I think one could monkey patch it in. I don’t know where they apply the style that makes the lines jiggly, but that’s half of it, the other is just the font. So if one were to find out how to do the line style with cairo that would get them most of the way there.

It must be some transformation of the paths coming in, but it needs to be done such that it doesn’t matter how close together the line points are I guess? So maybe not completely trivial to do.

1 Like

For a solution on how to do this in Python, see the code here. They interpolate along the path of the curve, add some orthogonal jitter to it and finally filter the jittered curve. The font used is the Humor Sans font.

1 Like