Function Repository Resource:

XKCDConvert

Source Notebook

Modify graphics to appear hand-drawn in the style of the xkcd cartoon series

Contributed by: Simon Woods (with contributions from Wolfram staff)

ResourceFunction["XKCDConvert"][graphics]

modifies graphics to appear hand-drawn in the style of the xkcd cartoon series.

Details and Options

ResourceFunction["XKCDConvert"] takes the option "Distortion", which controls the amount of distortion done to the input.

Examples

Basic Examples (1) 

Create a BarChart in the style of xkcd:

In[1]:=
ResourceFunction["XKCDConvert"][
 BarChart[{10, 1}, ChartLabels -> {"XKCD", "Others"}, PlotLabel -> "Popularity of questions on MMA.SE", Ticks -> {None, {{1, "Min"}, {10, "Max"}}}]]
Out[1]=

Scope (3) 

Style a Plot:

In[2]:=
f1[x_] := 5 + 50 (1 + Erf[x - 5]);
f2[x_] := 20 + 30 (1 - Erf[x - 5]);
ResourceFunction["XKCDConvert"][
 Plot[{f1[x], f2[x]}, {x, 0, 10}, Ticks -> {{{3.5, "1st Event"}, {7, "2nd Event"}}, Automatic}]]
Out[2]=

A PieChart:

In[3]:=
ResourceFunction["XKCDConvert"][
 PieChart[{9, 1}, ChartLabels -> {"XKCD", "Others"}, PlotLabel -> "Popularity of questions on MMA.SE"]]
Out[3]=

Plot random connected points in the style of xkcd:

In[4]:=
ResourceFunction["XKCDConvert"][
 ListLinePlot[RandomInteger[10, 15], PlotMarkers -> Automatic]]
Out[4]=

Options (1) 

Distortion (1) 

Increase the level of distortion:

In[5]:=
ResourceFunction["XKCDConvert"][
 ListLinePlot[RandomInteger[10, 15], PlotMarkers -> Automatic], "Distortion" -> 2]
Out[5]=

Publisher

Jon McLoone

Requirements

Wolfram Language 11.3 (March 2018) or above

Version History

  • 2.1.1 – 06 March 2023
  • 2.1.0 – 13 December 2021
  • 2.0.0 – 29 October 2020
  • 1.0.0 – 07 March 2019

License Information