add_layout_image doesn't work with secondary_y
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 18.8k
- Fork
- 2.8k
- Merge medio
- 16h 26m
- PR unite (30g)
- 21
Descrizione
Below is an example for which the second image is visible
fig = make_subplots(rows=1, cols=1, specs=[[{"secondary_y": True}]])
# Add trace
fig.add_trace(go.Scatter(x=[0, 0.5, 1, 2, 2.2], y=[1.23, 2.5, 0.42, 3, 1]))
fig.add_trace(go.Scatter(x=[0, 0.5, 1, 2, 2.2], y=[10.23, 20.5, 1.42, 30, 10]), secondary_y=True)
fig.update_yaxes(range=[0, 4], secondary_y=False)
fig.update_yaxes(range=[0, 40], secondary_y=True)
fig.add_layout_image(
dict(
source="https://images.plot.ly/language-icons/api-home/python-logo.png",
xref="x",
yref="y",
x=0,
y=1,
sizex=1,
sizey=1,
sizing="stretch",
opacity=1.0,
layer="below",
),
secondary_y=False,
)
fig.add_layout_image(
dict(
source="https://raw.githubusercontent.com/cldougl/plot_images/add_r_img/vox.png",
xref="x",
yref="y2",
x=1.5,
y=2,
sizex=1,
sizey=1,
sizing="stretch",
opacity=1.0,
layer="below",
),
secondary_y=True,
)
# Set templates
fig.update_layout(template="plotly_white")
fig.show()

replacing yref="y2", by yref="y", the image becomes visible but is anchored with the primary y axis (visible because of the sizey=1 and also when moving the axis range)

replacing yref="y2", by yref="y3", the image becomes visible but it is the only visible element

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 con la riproduzione Python fornita e segui l’entry point add_layout_image, concentrandoti su come vengono gestiti secondary_y e yref="y2". Il lavoro è completato quando entrambe le immagini di layout vengono renderizzate nelle posizioni corrette degli assi y primario e secondario, mentre le tracce tracciate rimangono visibili.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- data-visualization
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100