How to plotlyProxyInvoke(“relayout”, an image in plot please?
For example, an image stretched to fit the x,y field of view.
Aiming to update with images = list(source=raster2uri(obj).
plotlyProxy("plot4", session) %>%
plotlyProxyInvoke("relayout", list(
images = list(
source = raster2uri(a5), # converts a raster object to a data URI.
xref = "x", yref = "y", x = 0, y = m1, sizex = 800, sizey = m2-m1,
sizing = "stretch", xanchor = "left", yanchor = "bottom"
)
# ,xaxis = list(range = c(m1,m2))
))
Currently patching together a solution to hopefully pass jsonlite::toJSON(raster2uri(a5)) to session$sendCustomMessage. Then, ideally, set plot4.layout.images[0].source to ‘message’ in Shiny.addCustomMessageHandler.