import matplotlib.pyplot as plt
import numpy as np
# 0〜2の数字を色に対応させる
pixels = np.array([
[3,3,0,5,0,3,3,0,4,1,1,1,4,0],
[4,0,2,2,2,0,4,2,2,0,5,0,2,2],
[1,1,0,5,0,1,1,4,0,3,3,3,0,4],
[4,0,3,3,3,0,4,1,1,0,5,0,1,1],
[2,2,0,5,0,2,2,4,0,2,2,2,0,4],
[0,4,1,1,1,4,0,3,3,0,5,0,3,3],
[4,0,3,3,3,0,4,1,1,0,5,0,1,1],
[4,0,2,2,2,0,4,2,2,0,5,0,2,2],
[3,3,0,5,0,3,3,0,4,1,1,1,4,0],
[2,2,0,5,0,2,2,4,0,2,2,2,0,4],
[1,1,0,5,0,1,1,4,0,3,3,3,0,4],
[0,4,1,1,1,4,0,3,3,0,5,0,3,3],
])
# カラーマップを自作(0=白, 1=青, 2=赤)
from matplotlib.colors import ListedColormap
cmap = ListedColormap(["white","red", "blue", "yellow", "green"])
plt.imshow(pixels, cmap=cmap, interpolation='nearest')
plt.axis('off')
plt.show()
To embed this project on your website, copy the following code and paste it into your website's HTML: