Static image excludes layout_images if source is not absolute path
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 18.8k
- Fork
- 2.8k
- Merge medio
- 16h 26m
- PR unite (30g)
- 21
Descrizione
Hi there, I am currently failing to export a static image including a layout image.
The export does not show any errors but the layout images are just omitted in the exported data.
This is the case for fig.write_image() as well as plotly.io.to_image().
A simple example is:
import plotly.graph_objects as go
import numpy as np
x = np.linspace(0,3*np.pi,1000)
y = np.sin(x)
plotly_logo="Images/plotly.png"
fig = go.Figure(go.Scatter(x=x,y=y))
fig.add_layout_image(dict(
source=plotly_logo,
xref="paper",
yref="paper",
x=.5,
y=.5,
xanchor="center",
yanchor="middle",
sizex=.4,
sizey=.4
))
fig.write_image("Images/test.png", scale=3)
The image will be saved and show the sine curve but the plotly logo will not be visible.
But fig.show() shows the plotly logo nicely centered in the graph.
Switching out the relative path Images/plotly.png with a absolute one e.g. /home/user/Images/plotly.png the logo appears in the exported image file as well.
For me it seems, that the source argument is interpreted differently for different methods of showing the image.
Maybe someone knows, where to look to fix this?
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo l’esempio con una sorgente layout-image relativa, confrontando fig.write_image() e plotly.io.to_image() con il caso del percorso assoluto. Il lavoro è completato quando l’immagine layout con percorso relativo appare nelle esportazioni statiche di entrambi i metodi senza errori.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- data-visualization
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100