I am working on that beautiful meteogram with plotly
For this purpose I have to add several images to the plot. This takes a lot of time. Here ~4s for 144 images.
I tried to add all images as a list, but add_layout_images just takes a dict-like Image object as you can see in my snippet.
So is there a way to do this much faster ?
PS: Images are pre opened and stored into dict with from PIL.PngImagePlugin.PngImageFile objects. And I am running on the latest plotly version.
for location in range(len_forecast):
fig.add_layout_image(
go.layout.Image(
source=weather_icon_images[weather_icons[location]-1],
xref="x",
yref="y",
x=location + 0.5,
y=temp[location] + 0.4,
sizex=1.55,
sizey=1.8,
xanchor="center",
yanchor="middle"
))
fig.add_layout_image(
go.layout.Image(
source=wind_icon_images[wind_mapping[location]],
xref="x",
yref="paper",
x=location + 0.5,
y=-0.05,
sizex=0.9,
sizey=0.9,
xanchor="center",
yanchor="middle",
))
