Hacker News new | ask | show | jobs
TIL you could make xkcd-like plots with matplotlib (matplotlib.org)
108 points by bobsacamano19 946 days ago
8 comments

I've used this for documenting concepts where I don't want people getting bogged down in trying to glean precise relationships from the plots, just general ideas. People have also commented that it made some deeply technical documentation more approachable because it felt less formal.
Fun plot style, but the "noise" is too regular to really look right. Seems like like it basically just superimposes a sine wave onto all the straight lines.

Compare the axes of the plots, or the vertical lines on the bar chart which have a pretty distinct periodicity, to the original: https://xkcd.com/373/

Yes that's my take. I think its good enough for most use cases but if you really wanted that random effect you might consider replacing the lines using something like an ipad and pencil or stylus.
> but the "noise" is too regular to really look right

They probably did add the randomness (haven't checked nor confirmed), but it could be the higher resolution that makes it look really clear.

Yeah more wavy than scribbly
Shameless plug but this is exactly how I put together the graphs in my blog post[0]. It's very easy to use and surprisingly versatile although I did add a bit of photoshopping to get things exactly as I wanted them.

[0] https://summer.ai/blog ChatGPT should be your first cofounder

While I'm not a fan of the plot style, I use the xkcd colors from matplotlib.colors.XKCD_COLORS all the time. 954 colors named from the xkcd color survey [0].

[0] https://xkcd.com/color/rgb/

Do we really need "baby poop green" and "baby shit green" though?
Yes
There is also an R package to do the same thing as a ggplot theme: https://xkcd.r-forge.r-project.org/
is that how he does it? I wouldn't be surprised.
I would be. It's much quicker to draw this than to write code for it.
OTOH, not behavior from randal Monroe that would be surprising.
import antigravity