# XKCD style plots

**URL:** <https://discourse.julialang.org/t/xkcd-style-plots/89477>\
**Category:** General Usage\
**Tags:** question, plotting, makie\
**Created:** [October 29, 2022, 6:17am UTC](https://discourse.julialang.org/t/xkcd-style-plots/89477 "2022-10-29T06:17:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DoktorMike](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/doktormike/32/2736_2.png) [@DoktorMike](https://discourse.julialang.org/u/DoktorMike)\
**Post date:** [October 29, 2022, 6:17am UTC](https://discourse.julialang.org/t/xkcd-style-plots/89477/1 "2022-10-29T06:17:49Z")

</div>

I’m a frequent user of the `xkcd` [R package](https://xkcd.r-forge.r-project.org/) which allows you to make plots like the ones you see in [xkcd](https://xkcd.com/). 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.

---

<div class="post-metadata">

**Author:** ![digital\_carver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/digital_carver/32/33818_2.png) [@digital\_carver](https://discourse.julialang.org/u/digital_carver)\
**Post date:** [October 29, 2022, 9:38am UTC](https://discourse.julialang.org/t/xkcd-style-plots/89477/2 "2022-10-29T09:38:38Z")

</div>

[PyPlot.jl](https://github.com/JuliaPy/PyPlot.jl) and [PythonPlot.jl](https://github.com/stevengj/PythonPlot.jl) provide an interface to `matplotlib.pyplot`, and that library apparently has an `xkcd` function to plot in this style.  
[Source 1](https://gist.github.com/dpsanders/ef8e89bf68f304552aa3#inexact-plot)  
[Source 2](https://gist.github.com/cmundi/9041366)

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [October 29, 2022, 9:51am UTC](https://discourse.julialang.org/t/xkcd-style-plots/89477/3 "2022-10-29T09:51:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [October 31, 2022, 3:26pm UTC](https://discourse.julialang.org/t/xkcd-style-plots/89477/4 "2022-10-31T15:26:49Z")

</div>

> [@jules](#):
>
> but I think one could monkey patch it in.

For a solution on how to do this in Python, [see the code here](https://jakevdp.github.io/blog/2012/10/07/xkcd-style-plots-in-matplotlib/). 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.
