XKCD-style graphs

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

TobiasTPCS wrote at 2014-04-15 10:23:

Hello,

How hard would it be to implement 'xkcd style' linestyles? I see no current 'style' setting I could enhance with such a styling.

for people that don't know what I mean: http://xkcdgraphs.com

Image
Image

These plots are very useful to show estimate data instead of hard, absolute data.

I'm curious for your insights :-)

Tnx,

Tobias

objo wrote at 2014-04-15 10:35:

Hi Tobias, I really like this idea :-) It would be great for an example. And could be considered to include in the OxyPlot core. We need to create a custom "HandDrawnLinearAxis" and "HandDrawnLineSeries" using some "hand-draw" interpolation function.

See
http://jakevdp.github.io/blog/2012/10/07/xkcd-style-plots-in-matplotlib/
http://xkcdgraphs.com/xkcd.js

objo wrote at 2014-04-16 07:56:

I think there is a better way... I made the Render method of the PlotModel virtual. Now you can make an XKCD IRenderContext decorator and use this in the overridden render method. This means all content of the plot model can be XKCD style! :-) If someone can write the rand_func (see link) in c#, I can make the decorator! :) http://nbviewer.ipython.org/gist/anonymous/3835181

TobiasTPCS wrote at 2014-04-16 09:07:

Sounds good! I'll see if I can help tonight.

objo wrote at 2014-04-16 23:26:

The decorator is checked in. I just added some random jitter that doesn't look good. Please help on a xkcd filter function similar to the one used in mathematica/matplotlib!
Tip: install the Humor-Sans.ttf font (easily found by google).