importnumpyasnpnp.random.seed(123)
importplotly.expressaspximportplotly.subplotsassubplotsfromkeras.datasetsimportmnist# from keras.datasets import fashion_mnist as mnist
(X_train, y_train), (X_test, y_test) =mnist.load_data()
fig=subplots.make_subplots(rows=2, cols=5)
forn, imageinenumerate(X_train[:10]):
fig.add_trace(px.imshow(255-image).data[0], row=int(n/5)+1, col=n%5+1)
layout=px.imshow(X_train[0], color_continuous_scale='gray').layoutfig.layout.coloraxis=layout.coloraxisfig.update_xaxes(**layout.xaxis.to_plotly_json())
fig.update_yaxes(**layout.yaxis.to_plotly_json())
fig.show()
this results in this (screenshot):

download as png results in this:

Tangential: It is also way too complicated to generated a small preview selection of pictures. If there is an easier method please answer this stack overflow question
this results in this (screenshot):
download as png results in this:

Tangential: It is also way too complicated to generated a small preview selection of pictures. If there is an easier method please answer this stack overflow question