Iβm making an heatmap-like figure that is basically a NxM grid of small icons
The code Iβm using to produce this is sub-optimal, because it needs to iterate through every row and column to place the images.
for i, var in enumerate(rows): # these are the rows of the plots (members)
for _, row in df.iterrows(): # These are the columns of the plot (time)
fig.add_layout_image(
dict(
source=Image.open(row["icons"]),
x=row["time"],
y=y_positions[i],
sizex=12 * 24 * 10 * 60 * 100,
sizey=.5,
xref="x",
yref="y",
xanchor="center",
yanchor="middle",
),
)
Note that I also have to fiddle around with sizex
as the xaxis is in time units!
This code takes a while to finish, sometimes longer than a minute.
Isnβt there a better way to achieve this?