'Image and plotly plot side by side in R markdown

I am trying to show an image and a plot (plotly gauge) side-by-side in R markdown, however only a blank graph shows for the image. I have imported the image into plotly and am attempting to use subplot to show them side by side. Any advice on what I'm missing?


# Photo
photo <- plot_ly(domain = list(x = c(0, 0.5), y = c(0, 1)))%>%
  layout(
    images = list(source =  "C:/Users/Name/Documents//Image.PNG"
      ))

# Gauge value
x <- mean(df$variable)

# Plot
fig1 <- plot_ly(
  value = x,
  number = list(suffix = "%"),
  title = list(text = "Title"),
  type = "indicator",
  mode = "gauge+number",
  gauge = list(
    axis =list(range = list(NULL, 100)),
    steps = list(
      list(range = c(0, 78), color = "white"),
      list(range = c(78, 88), color = "green"),
      list(range = c(88, 100), color = "white")),
    bar = list(color = "black")),
  domain = list(x = c(0.5, 1), y = c(0, 1)))

subplot(photo, add_trace(fig1))


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source