title: Plotly layout with background image from local file
body: <p>I have the same problem as stated in <a href="https://stackoverflow.com/questions/50111539/plotly-background-images">this question</a>: I want my plot to have a background from a local png file.</p>
  <p>Using <a href="https://plot.ly/python/images/" rel="nofollow noreferrer">plotly's example</a>, which uses an image from the web, works.</p>
  <p>Using a path to my local image, with or without absolute path, does not work.</p>
  <p>Encoding as per the answer to this other question does not help.</p>
  <pre><code>import base64
  import os
  #import plotly.plotly as py
  import plotly.graph_objs as go
  from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
  
  import numpy as np
  
  trace1= go.Scatter(x=[0,0.5,1,2,2.2],y=[1.23,2.5,0.42,3,1])
  
  with open(os.getcwd() + &quot;/resources/office_map.png&quot;, &quot;rb&quot;) as image_file:
      encoded_string = base64.b64encode(image_file.read()).decode()
  # Add the prefix that plotly will want when using the string as source
  encoded_image = &quot;data:image/png;base64,&quot; + encoded_string
  
  layout= go.Layout(
      title='My title',
      images= [dict(
          source= encoded_image,
          xref= &quot;x&quot;,
          yref= &quot;y&quot;,
          x= 0,
          y= 10,
          sizex= 744,
          sizey= 1052,
          sizing= &quot;stretch&quot;,
          opacity= 0.5,
          layer= &quot;below&quot;)])
  
  fig=go.Figure(data=[trace1],layout=layout)
  plot(fig)
  </code></pre>
  <p>How hard can it be to get a local image as background? How do you do it?</p>