In [84]:
from matplotlib import pyplot as plt
from matplotlib.ticker import MultipleLocator
from matplotlib.patches import Polygon
from matplotlib.collections import PatchCollection
import numpy as np
import random

%matplotlib inline

In [119]:
POLYGONS = [Polygon([(0,0),(0,12),(2,10)], True),
           Polygon([(0,12),(6,12),(4,8)], True),
           Polygon([(6,12),(6,6),(4,8)], True),
           Polygon([(6,12),(6,6),(8,4),(9,6)], True),
           Polygon([(6,12),(9,6),(12,8), (12,12)], True),
           Polygon([(0,0),(2,10),(4,8)], True),
           Polygon([(3,0),(2,4),(3,6)], True),
           Polygon([(6,0),(6,6),(8,4)], True),
           Polygon([(8,4),(9,6),(12,0)], True),
           Polygon([(12,0),(9,6),(12,6)], True),
           Polygon([(9,6),(12,6),(12,8)], True),
           Polygon([(0,0),(2,4),(3,0)], True),
           Polygon([(3,0),(3,6),(4,8),(6,6),(6,0)], True),
           Polygon([(6,0),(8,4),(12,0)], True)]

COLORS = ["#94D0FF",
 "#8795E8",
 "#966bff",
 "#AD8CFF",
 "#C774E8",
 "#c774a9",
 "#FF6AD5",
 "#ff6a8b",
 "#ff8b8b",
 "#ffa58b",
 "#ffde8b",
 "#cdde8b",
 "#8bde8b",
 "#20de8b"]

COLORS2=["#392682","#7a3a9a","#3f86bc","#28ada8","#83dde0","#392682","#7a3a9a","#3f86bc","#28ada8","#83dde0","#392682","#7a3a9a","#3f86bc","#28ada8"]

def create_grid_plot():
    fig, ax = plt.subplots(figsize=(8,8))
    fig.patch.set_facecolor('white')
    plt.subplots_adjust(wspace=0)
    ax.set_xlim([0,12])
    ax.set_ylim([0,12])
    ax.tick_params(axis='y', which='both', labelleft='off', labelright='off')
    ax.tick_params(axis='x', which='both', labelbottom='off', labeltop='off')
    ax.tick_params(axis='y', which='both', left='off', right='off')
    ax.tick_params(axis='x', which='both', top='off', bottom='off')
    ax.xaxis.set_major_locator(MultipleLocator(1))
    ax.yaxis.set_major_locator(MultipleLocator(1))
    ax.grid(which='major', axis='both', alpha=0.5)
    pc = PatchCollection(POLYGONS,
                         color=COLORS,
                         edgecolor='k',
                         linewidth=1,
                         alpha = 0.75)
    ax.add_collection(pc)
    plt.show()
    
create_grid_plot()



In [ ]: