# Re: [Matplotlib-users] XKCD style graphs?

```On Thu, Oct 4, 2012 at 10:44 AM, Damon McDougall
<damon.mcdoug...@gmail.com> wrote:
> On Thu, Oct 4, 2012 at 10:02 AM, Pierre Haessig
> <pierre.haes...@crans.org> wrote:
>> Hi Fernando,
>>
>> Le 04/10/2012 09:16, Fernando Perez a écrit :
>>> This would make for an awesome couple of examples for the gallery, the
>>> mathematica solutions look really pretty cool:
>>>
>>> http://mathematica.stackexchange.com/questions/11350/xkcd-style-graphs
>> I've never used Mathematica so that it's pretty difficult for me to
>> understand the following lines of code which I guess do the main job of
>> distorting the image
>>
>> xkcdDistort[p_] := Module[{r, ix, iy},
>>    {ix, iy} =
>>     Table[RandomImage[{-1, 1}, ImageDimensions@r]~ImageConvolve~
>>       GaussianMatrix[10], {2}];
>>      # + 15 {ImageValue[ix, #], ImageValue[iy, #]} &, DataRange ->
>> Full], -5]];
>>
>>
>> Is there somebody there that can describe this algorithm with words
>> (English or Python ;-)) ?
>>
>> I feel like the key point is about adressing the rasterized plot image
>> "r" with some slightly randomized indices "ix" and "iy". However, I
>> really don't get the step that generates these indices.
>>
>> Best,
>> Pierre
>
> I believe this is in your interests: http://i.imgur.com/5XwRO.png
>
> Here's the code: https://gist.github.com/3832579
>
> Disclaimer: The code is ugly; don't judge me. Also, I installed the
> Humor Sans font but I couldn't get mpl to find it. Oh well :)```
```
I got the font working :) http://i.imgur.com/Dxemm.png

--
Damon McDougall
http://www.damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
```