lagom.vis: Visualization

class lagom.vis.ImageViewer(max_width=500)[source]

Display an image from an RGB array in an OpenGL window.


imageviewer = ImageViewer(max_width=500)
image = np.asarray('x.jpg'))

Create an image from the given RGB array and display to the window.

Parameters:x (ndarray) – RGB array

Initialize the OpenGL window.

Parameters:max_width (int) – maximum width of the window.

Close the Window.

class lagom.vis.GridImage(ncol=8, padding=2, pad_value=0)[source]

Generate a grid of images. The images can be iteratively added.


grid = GridImage(ncol=8, padding=5, pad_value=0)

a = np.random.randint(0, 255+1, size=[10, 3, 64, 64])


  • ncol (int, optional) – Number of images to show in each row of the grid. Final grid size is [N/ncol, ncol]. Default: 8.
  • padding (int, optional) – Number of paddings. Default: 2.
  • pad_value (float, optional) – Padding value in the range [0, 255]. Black is 0 and white 255. Default: 0

Make grid of images.

Parameters:**kwargs – keyword aguments used to specify the grid of images.
Returns:img – a grid of image with shape [H, W, C] and dtype np.uint8
Return type:Image

Add a new data for making grid images.

Parameters:x (list/ndarray) – a list or ndarray of images, with shape either [H, W], [C, H, W] or [N, C, H, W]
lagom.vis.set_ticker(ax, axis='x', num=None, KM_format=False, integer=False)[source]
lagom.vis.read_xy(log_folder, file_name, get_x, get_y, smooth_out=False)[source]