Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Reassigning Yaxis Labels Inconsistent When Using hoversubplots & hovermode set

Aperta
#4,777 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python

Direzione di ricerca

Esegui la riproduzione Python fornita e analizza il layout della figura generata e il comportamento dell'hover per i sei assi y con hoversubplots="axis" e hovermode="x unified". Traccia il motivo per cui due titoli degli assi y assegnati non vengono visualizzati e considera completata la issue quando tutte e sei le etichette possono essere rinominate in modo coerente e il comportamento è coperto da un test di regressione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I've been having an issue when you define two xaxes and populate three yaxes per xaxis (in a 2x3) grid while setting "hoversubplots= "axis"", with "hovermode= "xunified"". I've found I cannot rename two of the 6 Yaxis labels.

import plotly.graph_objects as go
from datetime import date
from plotly import subplots
import random

def get_test_data():
    x_data, y_data = [], []
    for v in range(30):
        x_data.append(date(2024, 10, v+1))
        y_data.append(random.random())
    return x_data, y_data

data= []
for yaxis in range(1,7):

    if yaxis % 2:
        xaxis = "x1"
    else:
        xaxis= "x2"

    x, y = get_test_data()
    data.append(go.Scatter(x= x, y= y, xaxis= f"{xaxis}", yaxis= f"y{yaxis}", name= f"Test{yaxis}y{yaxis}"))

titles = ["First","Second","Third","Fourth","Fifth","Sixth"]
layout = dict(
    hoversubplots= "axis",
    hovermode= "x unified",
    title= "Test Plot",
    font= dict(
        family= "Courier New, monospace",
        size= 14,
        color= "rgba(255,255,255,1)"),
    plot_bgcolor= "rgba(0,0,0,1)",
    paper_bgcolor= "rgba(0,0,0,1)",
    grid= dict(rows=3, columns=2),
    )

figure= subplots.make_subplots(rows= 3, cols=2, subplot_titles= titles, specs= [[{},{}] for i in range(3)])
figure.add_traces(data[0])
figure.add_traces(data[1])
figure.add_traces(data[2])
figure.add_traces(data[3])
figure.add_traces(data[4])
figure.add_traces(data[5])
figure["layout"][f"yaxis1"]["title"] = "yaxis1"
figure["layout"][f"yaxis2"]["title"] = "yaxis2"
figure["layout"][f"yaxis3"]["title"] = "yaxis3"
figure["layout"][f"yaxis4"]["title"] = "yaxis4"
figure["layout"][f"yaxis5"]["title"] = "yaxis5"
figure["layout"][f"yaxis6"]["title"] = "yaxis6"

figure.update_layout(layout)
figure.update_xaxes(gridcolor="rgba(80,80,80,1)", showticklabels= True)
figure.update_yaxes(gridcolor="rgba(80,80,80,1)", autorange= True, showticklabels= True)

figure.show()
Lingua principale
Python
Stelle
18.8k
Fork
2.8k
Merge medio
13h 41m
PR unite (30g)
21

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di plotly/plotly.py

Tutte le issue di plotly/plotly.py

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.