title: R plotly add a image in background
body: <p>I try to use the "plotly" R package to plot an image in an R graphic.</p>
  
  <p>I first tried to include an image from a local computer:</p>
  
  <pre><code>library(plotly)
  
  outfile &lt;- tempfile(fileext = ".png")
  
  png(outfile)
  plot(rnorm(200), rnorm(200))
  dev.off()
  
  plot_ly(x = c(1, 2, 3), y = c(1, 2, 3)) %&gt;%
    layout(
      images = list(
        list(
          source =  outfile,
          xref = "x",
          yref = "y",
          x = 1,
          y = 1,
          sizex = 2,
          sizey = 2,
          sizing = "stretch",
          opacity = 0.4,
          layer = "below"
        )
  
  
      )
    )
  </code></pre>
  
  <p>But I did not manage to do it. I then thought that was because plotly apparently requires an http or https image.</p>
  
  <p>First question: Is it possible to import image from a local file (apparently it is possible with python: <a href="https://plot.ly/python/images/" rel="nofollow noreferrer">https://plot.ly/python/images/</a>)? </p>
  
  <p>As it seems to be impossible to embed a local image, I try to import an image that I had upload on my Github. But it seems not to work neither: </p>
  
  <pre><code>library(plotly)
  
  plot_ly(x = c(1, 2, 3), y = c(1, 2, 3)) %&gt;%
    layout(
      images = list(
        list(
          source =  "https://github.com/charlottesirot/elementR/blob/master/inst/www/2.png",
          xref = "x",
          yref = "y",
          x = 1,
          y = 1,
          sizex = 2,
          sizey = 2,
          sizing = "stretch",
          opacity = 0.4,
          layer = "below"
        )
  
  
      )
    )
  </code></pre>
  
  <p>What is the problem here?</p>
  
  <p>I have looked everywhere, posted questions on plotly forum (<a href="http://community.plot.ly/t/import-a-local-image-in-plot/2476" rel="nofollow noreferrer">http://community.plot.ly/t/import-a-local-image-in-plot/2476</a>, <a href="http://community.plot.ly/t/add-a-background-image/2457" rel="nofollow noreferrer">http://community.plot.ly/t/add-a-background-image/2457</a>) but I did not find my answers.</p>
  
  <p>Do you have any idea? </p>