Adding logo to a plot using `layout` doesn't work with local images.
Open
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
Description
It appears that if you add a logo to a plotly figure using the layout function, it only works when using a remotely hosted image. Using the example on the logo tutorial, the logo is added to the plot if you point to a remote url, but not if you point to a local image:
library(plotly)
# photo used in Plotly logo example page
url <- "https://images.plot.ly/language-icons/api-home/python-logo.png"
download.file(url, "./python-logo.png")
fig <- plot_ly(x = c(1, 2, 3), y = c(1, 2, 3))
fig <- fig %>% add_lines()
this_works <- fig %>%
layout(
images = list(
list(source = url,
xref = "paper",
yref = "paper",
x= 0,
y= 1,
sizex = 0.2,
sizey = 0.2,
opacity = 0.8
)
)
)
this_doesnt <- fig %>%
layout(
images = list(
list(source = "./python-logo.png",
xref = "paper",
yref = "paper",
x= 0,
y= 1,
sizex = 0.2,
sizey = 0.2,
opacity = 0.8
)
)
)
Created on 2023-05-23 with reprex v2.0.2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the layout(images = ...) entry point shown in the issue and compare how its remote URL and local image source are handled. Reproduce the example with the downloaded python-logo.png; done means the local image appears in the plot as the remote image does.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100