I have a 50 x 300 pandas data frame titled embeddings and would like to view it as a numpy array. I am using the function view_samples below:
def view_samples(samples, m, n):
fig, axes = plt.subplots(figsize=(10, 10), nrows=m, ncols=n, sharey=True, sharex=True)
for ax, img in zip(axes.flatten(), samples):
ax.xaxis.set_visible(False)
ax.yaxis.set_visible(False)
im = ax.imshow(1-img.reshape((50,300)), cmap='Greys_r')
return fig, axes
And running it as follows:
faces = [embeddings.to_numpy()]
_ = view_samples(faces, 1, 4)
The current result is shown below. Only the first one (leftmost) is correct, the other pictures are not.

Given the error, I am also trying to rewrite the function such that I do not include subplots, i.e. just the leftmost one.