I am trying to create a grid with gray, white and black colors and specify these colors for each box in the grid. I could create a grid with 2 rows and three columns, but not sure to specify the colors in the grid (not randomly color the boxes in the grid)
Code
import matplotlib.pyplot as plt
import numpy as np
# Make a 2x3 grid...
nrows, ncols = 2,3
image = np.zeros(nrows*ncols)
image = image.reshape((nrows, ncols))
row_labels = ["Attractor1", "Attractor2"]
col_labels = ['BCL6', 'GRIN2A', 'PAFAH1B1']
plt.matshow(image)
plt.xticks(range(ncols), col_labels)
plt.yticks(range(nrows), row_labels)
plt.show()
This is how I want to create the grid figure
I also tried this code below. But, I don't how to specify the color for gray and change the lables
import matplotlib.pyplot as plt
a = [[0,1],[1,0]]
plt.imshow(a,cmap='gray')
plt.show()
Thanks