简体   繁体   中英

Embed image in Plotly

I am trying to embed image in Plotly graph but somehow the image is not displayed. Does anyone have any idea what am I missing:

library(plotly)
p <- plot_ly(x=c(1, 2, 3), y=c(1, 2, 3), type='scatter')
p2 <-
p %>%
layout(images = list(
list(source = "https://images.plot.ly/language-icons/api-home/python-logo.png",
     xref = "paper",
     yref = "paper",
     x= 0,
     y= 1,
     sizex = 0.2,
     sizey = 0.2,
     opacity = 0.8)
)
)
p2

may be problem in '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.

And second list you don't need.

layout(images =
  list(source = "https://images.plot.ly/language-icons/api-home/python-logo.png"...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM