text_plain_output_1.png
import matplotlib.pyplot as plt

X = X.reshape(X.shape[0], 28, 28)
X = X / 255.0

import matplotlib.pyplot as plt
fig = plt.gcf()
fig.set_size_inches(9, 9)
for i, img in enumerate(X):
    if i + 1 > 3 * 3:
        break
    plt.subplot(3, 3, i + 1)
    plt.imshow(img)
plt.show()