Apress / advanced-applied-deep-learning

Source Code for 'Advanced Applied Deep Learning' by Umberto Michelucci
Other
39 stars 33 forks source link

[ISSUE] In source codes, there is no plt show codes about chess board #8

Closed ScGPS closed 1 year ago

ScGPS commented 1 year ago

Issue

image

Fixed issue

# Output chess board image (chess board image)
import numpy as np
import matplotlib.pyplot as plt

chessboard  = np.zeros([8*20,8*20])
for row in range(0,8):
    for column in range(0,8):
        if((column+8*row) % 2 ==1) and (row % 2 == 0):
            chessboard[row*20:row*20+20,column*20:column*20+20] = 1
        elif((column+8*row) % 2 ==0) and (row % 2 == 1):
            chessboard[row*20:row*20+20,column*20:column*20+20] = 1

#set the plot's title.
#plt.title('Chess Board')

plt.xlim(xmin=0,xmax=160)
plt.ylim(ymin=0,ymax=160)

plt.imshow(chessboard,cmap='binary_r')
# Print the chart
plt.show()

image

image