How to ensure an image stays at the same coordinates on pan / zoom?


I have a line graph and a background image inserted at the last time stamp / last value of the line graph.

When I pan or zoom, the line trace remains at the same x/y coordinates,
but not the inserted image. Is there an incantation to tell plotly that the image should remain at the same coordinates on pan / zoom?

Here is a reprex:

# The image is hosted at :

# Please download and use in the following incantation:

mysource = base64enc::dataURI(file = "~/Downloads/Flashing Circle - Imgur.gif")

plot_ly() %>%
    add_trace(x=as.Date((Sys.Date()-99):(Sys.Date())), y =1:100,type="scatter",mode="lines",color="#ff7f#0e") %>%       
    layout(images = list(
                      source = mysource,       
                      x=as.Date(Sys.Date()),y = 100,
                      xref = "x", yref = "y",
                      yanchor = "middle",


I just realized I could make a GIANT invisible background with the Flashing circle just at the right place.

Then I could put the giant image as the background and make it zoom able as described here : Images with R

I wonder if anyone has an opinion on that.