// Create images for a custom tooltip array
tooltip_s = []
for image_data in data:
output = io.BytesIO()
img = toimage(image_data.reshape((8, 8))) // Data was a flat row of 64 "pixels".
img.save(output, format="PNG")
contents = output.getvalue()
img_encoded = base64.b64encode(contents)
img_tag = <img src="data:image/png;base64,{}">.format(img_encoded.decode("utf-8"))
tooltip_s.append(img_tag)
output.close()
tooltip_s = np.array(tooltip_s) // need to make sure to feed it as a NumPy array, not a list
// Initialize to use t-SNE with 2 components (reduces data to 2 dimensions). Also note high overlap_percentage.
After Change
// Raw data is (0, 16), so scale to 8 bits (pillow can"t handle 4-bit greyscale PNG depth)
scaler = MinMaxScaler(feature_range=(0, 255))
data = scaler.fit_transform(data).astype(np.uint8)
// Create images for a custom tooltip array
tooltip_s = []
for image_data in data: