lets_plot.bistro.im.image_matrix#

lets_plot.bistro.im.image_matrix(image_data_array, cmap=None, *, norm=None, vmin=None, vmax=None, scale=1) GGBunch#

Display a set of images in a grid. Dimensions of the grid are determined by the shape of the input Numpy 2D array.

Each element of the input 2D array is an 2D or 3D Numpy array itself specifying either a grayscale image (2D array) or a color RGB(A) image (3D array). For more information on image arrays please see the documentation of geom_imshow() function.

Parameters:
image_data_arrayndarray

2D numpy.ndarray containing images.

cmapstr, optional

Name of colormap. For example “viridis”, “magma”, “plasma”, “inferno”, or any other colormap which is supported by the Palettable package (jiffyclub/palettable) This parameter is ignored for RGB(A) images.

normbool, optional, default=True

True - luminance values in grey-scale image will be scaled to [0-255] range using a linear scaler. False - disables scaling of luminance values in grey-scale image. This parameter is ignored for RGB(A) images.

vmin, vmaxnumber, optional

Define the data range used for luminance normalization in grey-scale images. This parameter is ignored for RGB(A) images or if parameter norm=False.

scalefloat, default=1.0

Specify the image size magnification factor.

Returns:
GGBunch

Plot bunch object.

Examples

1import numpy as np
2from lets_plot import *
3from lets_plot.bistro.im import *
4LetsPlot.setup_html()
5np.random.seed(42)
6image = np.random.randint(256, size=(64, 64, 3))
7matrix = np.empty((2, 3), dtype=object)
8matrix.fill(image)
9image_matrix(matrix)

 1import numpy as np
 2from lets_plot import *
 3from lets_plot.bistro.im import *
 4LetsPlot.setup_html()
 5rows, cols = 3, 3
 6matrix = np.empty((rows, cols), dtype=object)
 7for r in range(rows):
 8    for c in range(cols):
 9        w, h = 32 + 16 * c, 32 + 16 * r
10        matrix[r][c] = 256 * np.linspace(np.linspace(0, .5, w), \
11                                         np.linspace(.5, .5, w), h)
12image_matrix(matrix, norm=False, scale=1.5)