Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Embedding multiple images to a 3D scatter plot?

Hello,

Iam working on a 3D scatter plot in Plotly in R at the moment and would like to insert two image files. However I only managed to insert one image, and cannot add a second one at a different location.

Here’s the code I used:

fig <- fig %>% layout(images =
list(
source = base64enc::dataURI(file = “/Users/username/Desktop/image1.png”),
x = -0.02, y = 1.02, sizex = 0.17, sizey = 2,
xref = “paper”, yref = “paper”,
xanchor = “left”, yanchor = “center”),
list(
source = base64enc::dataURI(file = “/Users/username/Desktop/image2.png”),
x = 1, y = 1, sizex = 0.15, sizey = 1,xref = “paper”, yref = “paper”,
xanchor = “right”, yanchor = “above”), margin = list(t = 50))
fig

Would be grateful for any hint!

Thanks

Hi @custos,

I’m a plotly.py user, but looking at your code I can deduce why your second image is not displayed.

images is a list. Hence the first image data represent the first list element, while the second image data, the second list element. From your code it seems that you added two lists, not a list with two elements.