Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

How to user images and its source attribute

My plotly scatter chart works in my Shiny for R application. Now I am trying to add a background image to the plot using the ‘layout’ and its source attribute. Here is the relevant piece of code:

    pplot <- plot_ly(type='scatter',mode='lines',x=df[,2],y=df[,1],line=list(color='black'))%>%
      add_trace(x=c(min(df[,2]),max(df[,2])),y=Well[2:3,3],line=list(color='red'))%>%
      layout(xaxis=list(title=dd_xlabels[xnm],titlefont=list(size=12),showgrid=TRUE,showline=TRUE),
             yaxis=list(showgrid=TRUE),showlegend=FALSE,images=list(source("C1_9195-9197.jpg",local=TRUE)))

I am getting the following error:

EOF whilst reading MBCS char at line 1

With a stacktrace that shows that the error is in the line above. If I remove “images=list(…” then the plot renders fine but obviously without the background image in the file C1_9195-9197.jp