XKCD

In this lesson, we will learn how to plot a chart in XKCD-style.

Are you familiar with xkcd? xkcd is a webcomic that focuses on romance, sarcasm, math, and language. Its comic format is very distinctive and easy to recognize. Matplotlib helps us create an xkcd-style plot with only one additional line of code. As we can see from the example code below, we can wrap our normal code with a with plt.xkcd() clause, which we’ve done in line 4. The chart will now be converted to xkcd-style. This is the only code we need to add. Everything else remains the same

import matplotlib.pyplot as plt

with plt.xkcd():
    ## Plot your chart here 

Get hands-on with 1400+ tech skills courses.