# lets plot this pixels so we can see the image fig =plt.figure(1, (14, 14)) k = 0 for label in sorted(data.emotion.unique()): for j in range(7): px = data[data.emotion == label].pixels.iloc[k] px = np.array(px.split(' ')).reshape(48, 48).astype('float32') k += 1 ax = plt.subplot(7,7,k) ax.imshow(px,cmap='gray') ax.set_xticks([]) ax.set_yticks([]) ax.set_title(emotion_label_to_text[label]) plt.tight_layout()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter