xbm = '''
#define a_xbm_width  16
#define a_xbm_height 16
static char a_xbm_bits[] = {
    0x01, 0x00,
    0x02, 0x00,
    0x04, 0x00,
    0x08, 0x00,
    0x10, 0x00,
    0x20, 0x00,
    0x40, 0x00,
    0x80, 0x00,
    0x00, 0x01,
    0x00, 0x02,
    0x00, 0x04,
    0x00, 0x08,
    0x00, 0x10,
    0x00, 0x20,
    0x00, 0x40,
    0x00, 0x80
  )};
'''

with open('a.xbm', 'w') as f:
  f.write(xbm)
  
display(Image.open("a.xbm"))

Colab に表示された XBM 画像を貼ってください。

例

import numpy as np import matplotlib.pyplot as plt import math from mpl_toolkits.mplot3d import Axes3D from PIL import Image, ImageFilter, ImageOps, ImageChops, ImageStat from google.colab import files from io import BytesIO import os xbm = ''' #define a_xbm_width 16 #define a_xbm_height 16 static char a_xbm_bits[] = { 0x00, 0xe0, 0x00, 0xf0, 0x00, 0xf8, 0x00, 0x7c, 0x00, 0x3e, 0x00, 0x1f, 0x8c, 0x0f, 0xdc, 0x07, 0xf8, 0x03, 0xf8, 0x01, 0xf0, 0x00, 0xf8, 0x01, 0xdc, 0x03, 0x0f, 0x03, 0x07, 0x00, 0x07, 0x00 )}; '''

with open('a.xbm', 'w') as f: f.write(xbm)

display(Image.open("a.xbm"))

download.png

XBM checker