How can I render plots and graphics that mimic how mathematicians draw diagrams?

For example Look at this shirt:

enter image description here

The diagrams represent 2D and 3D shapes, however they have characteristics of human drawings. The curves are not perfect and exhibit lot's of noise and waviness that a computer rendering would normally not have. If you know any papers regarding this topic, please add them as reference to your answer.

As a side note and perhaps somewhat off topic: Is there a C++ library that can do tex rendering onto textures?


1 Answer 1


You might want to check matplotlib-cpp. You'll find a "funny-looking xkcd-styled example" in the README.

I also saw xkcd related entries on matplotlib's Python documentation. So, it should be available in Python too. However, I did not use these libraries myself. I just stumbled upon matplotlib-cpp while I was looking for a plotting library for C++.

  • $\begingroup$ This is neat and I will try it, although I am more interested in the technique itself. i.e. I am looking for the algorithm not the software. But I can take a peek at the implementation of that package, thank you. $\endgroup$
    – Makogan
    Dec 20, 2020 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.