Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
xkcd-gnuplot
============

How to plot xkcd-style functions with gnuplot!
A small gnuplot example for making plots look a bit like an xkcd chart.

![Sample Graph](./xkcd.png)

## Notes

This is not a full xkcd rendering. The axes are still straight, and for plotted functions the random jiggle is only applied on the y coordinate. For datapoints, the same idea can be applied on both x and y.

A proper solution would likely be a dedicated xkcd terminal for gnuplot, but this script keeps things simple.

The script uses the Humor Sans font. The original TTF can be downloaded from antiyawn.com. For the EPS terminal, the font must be converted to PostScript PFA format. A converted `Humor-Sans.pfa` file is already included in the repository and referenced by the script.

## How to use

The main example is in `xkcd.gp`. Run it with gnuplot to generate `xkcd.eps`.

The script defines two small helpers for adding wobble to plotted values:

- `jiggle(x)` applies a small relative variation. Use it when the distortion should scale with the plotted value.
- `jigglea(x)` applies a small absolute variation based on a fixed range. Use it when you want a fixed-size wobble.

In the included example, the damped sine and cosine curves use `jiggle(...)`, while the parabola-style guide line uses `jigglea(...)`.