@jamesdalg : According to : Single-page reference in R
source : Specifies the URL of the image to be used. The URL must be accessible from the domain where the plot code is run, and can be either relative or absolute.
The problem seems to occur here. For now, any image that can be accessed from web (https images) seem to work fine with the code above. Unfortunately, I don’t think they are supporting local files yet.
Are other plotly plots getting plotted in your RStudio? Try viewing them in your browser instead.
The following code gives the expected output.
library(plotly)
library(magrittr)
p <- plot_ly(x = c(1, 2, 3), y = c(1, 2, 3)) %>%
add_lines() %>%
layout(
images = list(
list(source = "https://images.contentful.com/w3cthbuv8rf8/1g2AFv1q32mcceWaSK6CCS/7e8ae1f1a9266a044aa1c7988612b985/2008-the-dark-knight-version-of-the-symbol-is-largely-unchanged-from-the-original.png",
xref = "x",
yref = "y",
x = 1,
y = 3,
sizex = 2,
sizey = 2,
sizing = "stretch",
opacity = 0.5,
layer = "below"
)
)
)
p
Please try by uploading your image to github/imgur and check if your code is running then. No other option seems to working for now. ggplot2 might be an alternate. annotation_custom() is an option I used.