Python matplotlib - Image titles not displaying in loop -


i wish display images in loop image name title. each image displays in loop title not.

in function below, img_list contains lists following [image, image_title].

def display_images(img_list, cmap='gray', cols = 2, fig_size = (10, 10) ):     """     display images in img_list     """     = 1  # subplot      num_images = len(img_list)     num_rows = num_images / cols      plt.figure(figsize=fig_size)             image in img_list:         image_file_name = image[1]         plt.subplot(num_rows, cols, i)                 plt.title = image_file_name         plt.imshow(image[0], cmap=cmap)                 += 1           plt.show() 

thanks.

if reassign plt.title, title() function overwritten string.

instead need call plt.title() function.

plt.title(image_file_name) 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -