gnuplotsketching

Gnuplot: how to mimic sketch graphs


I want to plot a figure like this one:

enter image description here

but with only sketched data curves. The x and y axes should not be sketched.

Is this possible using Gnuplot?


Solution

  • I think you may find this link useful, since it's exactly what you are asking for :)

    http://rfonseca.github.io/xkcd-gnuplot/

    Essentially, it applies a function to jiggle the line and make it pseudo-hand-drawn:

    jiggle(x) = x*(1+(2*rand(0)-0.5)*0.015)
    plot jiggle(sin(x))
    

    And this is the result:

    You may also want to increase samples with set samples 1000 to have better results avoiding spikes in jiggled lines.

    (As a curiosity, that page is inspired by a StackExchange answer, that contains a very advanced (and amazing, IMHO) approach to this problem, unfortunately only for Mathematica users.)