0

I have a bunch of images named 'arbitrary_name + index(i,j)', I would like to read those files first and combine them into a matrix-like plot which has a dimension of len(i)*len(j), each image is located in accordance with their name index. Is there any way I can do that?

In other words, use images instead of values in the heat map.

TxWang
  • 57
  • 2
  • 11
  • 1
    You can achieve it with subplots (https://matplotlib.org/api/_as_gen/matplotlib.pyplot.subplots.html) and zero margins between subplots – taras Jun 19 '18 at 16:59
  • or concatenate images with PIL https://stackoverflow.com/questions/30227466/combine-several-images-horizontally-with-python – aiven Jun 19 '18 at 17:07

1 Answers1

0

Use the function subplots for example:

import matplotlib.pyplot as plt
...

fig, ax = plt.subplots(nrows=len(i), ncols=len(i), sharex=True, sharey=True,)
ax = ax.flatten()
for idx in range(len(i)):    
  for jdx in range(len(j)): 
    ax[idx,jdx].imshow(the arbitrary_name_index using idx,jdx as indeces)

You most adjust the code to works

Rolando Corratge Nieves
  • 1,233
  • 2
  • 10
  • 25