I am trying to set an image that I have stored locally as the background for a heatmap. I followed the example at https://plot.ly/python/images/ and I am able to show a web-addressed image as the background image for my heatmap, but when I use a local image (both relative and absolute address) the image does not show and no error message is indicated. The reference (https://plot.ly/python/reference/#layout-images-source) doesn’t say anything about this address being restricted to web addresses. I am using plotly offline and my code is below.
trace1 = dict(z=np.flipud(vals),
type="heatmap",
zmin=0.0,
zmax=1.0,
colorscale='YlOrRd',
opacity= 0.5)
# source_image_url = '/home/hannahrae/data/05092017/' + img_name + '.png' (this is the one that doesn't work
source_image_url = 'https://upload.wikimedia.org/wikipedia/commons/thumb/e/e1/FullMoon2010.jpg/800px-FullMoon2010.jpg'
print source_image_url
layout = go.Layout(images=[dict(source=source_image_url,
xref= "x",
yref= "y",
x= 0,
y= h,
sizex= w,
sizey= h,
sizing= "stretch",
opacity= 0.5,
layer= "below")],
title= ("Probability of Quality Acceptance Across Image for %s", d))
fig = go.Figure(data=[trace1], layout=layout)
py.plot(fig)