tickvals and ticktext don't work with subcategory axes
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 18.8k
- Fork
- 2.8k
- Merge medio
- 16h 26m
- PR unite (30g)
- 21
Descrizione
If a plot has multi-category axes there is no way to hide a subcategory labels only and the plot doesn't render at all if tickvals and ticktext are used.
Look at the code without multi-categories:
x_names = ['very.long.name.1', 'very.long.name.2', 'very.long.name.3']
fig = go.Figure(go.Bar(
x=x_names,
y=[10, 20, 30]))
fig.update_layout(
xaxis=dict(
tickvals=x_names,
ticktext=['', '', ''],
))
This works fine and all x-axes labels are hidden. I could achieve the same thing with this:
fig.update_layout(xaxis=dict(showticklabels=False))
However, if this is a multi-category plot it doesn't work at all:
x_names = [['A', 'A', 'B'], ['very.long.name.1', 'very.long.name.2', 'very.long.name.3']]
fig = go.Figure(go.Bar(
x=x_names,
y=[10, 20, 30]))
fig.update_layout(
xaxis=dict(
tickvals=x_names,
ticktext=[['A', 'A', 'B'], ['', '', '']],
))
Setting showticklabels=False hides everything and I didn't find a way to hide just a single category labels.
What is really surprising this doesn't work either even if this doesn't change anything:
x_names = [['A', 'A', 'B'], ['very.long.name.1', 'very.long.name.2', 'very.long.name.3']]
fig = go.Figure(go.Bar(
x=x_names,
y=[10, 20, 30]))
fig.update_layout(
xaxis=dict(
tickvals=x_names,
ticktext=x_names,
))
I believe it should work like this:
tickvalsandticktextwork fine with a multi-category plotsshowticklabelsshould accept a list of booleans, .e.g.[True, False]to be able to hide a given subcategory if this is a multi-category plot
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 gli esempi a categoria singola e a più categorie nell’issue e confronta il comportamento risultante degli assi. Traccia il modo in cui gli assi con più categorie elaborano xaxis.tickvals, ticktext e showticklabels; il lavoro è completato quando tickvals e ticktext funzionano per i grafici con più categorie ed è possibile nascondere le etichette delle singole categorie.
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
- 42/100