# Generated by pandoc-plot 1.8.0
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(2019)

import random
import math
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import itertools

SIDE_LENGTH = 4

mm_to_in = 0.03937008

def draw_square(ax, center, color='w'):
    ax.add_patch(
        mpatches.Rectangle(
            xy=center,
            width=SIDE_LENGTH + 0.1,
            height=SIDE_LENGTH + 0.1,
            facecolor=color,
            edgecolor="none",
            fill=True,
        )
    )

figure, ax = plt.subplots(
    1, 1, figsize=(100 * mm_to_in, 100 * mm_to_in), frameon=False
)

# Dimensions of the page in mm
ax.set_xlim([0, 100])
ax.set_ylim([0, 100])

colormap=plt.get_cmap('cool')
centers=list()
rows    = np.arange(start=0, stop=105, step=SIDE_LENGTH)
columns = np.arange(start=0, stop=105, step=SIDE_LENGTH)
for x, y in itertools.product(rows, columns):
    r = math.hypot(x, y) / math.hypot(100, 100)
    draw_square(ax, center=(x,y), color=colormap(r + random.gauss(0, 0.03)))


ax.axis("off")
plt.subplots_adjust(top=1, bottom=0, left=0, right=1)
Click here to see how this plot was generated.