matplotlib / matplotlib/matplotlib

[Bug]: axes.prop_cycle behavior change

Aperta
#29,915 6 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Python
Stelle
23.2k
Fork
8.5k
Merge medio
1g 6h
PR unite (30g)
66

Descrizione

PR #29808 (identified by git bisect) changed the behavior of:

$ python -c 'import matplotlib; print(matplotlib.rcParams.get("axes.prop_cycle").by_key()["color"])'
['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf']

to now be a list of tuple of float rather than a list of str:

$ python -c 'import matplotlib; print(matplotlib.rcParams.get("axes.prop_cycle").by_key()["color"])'
[(0.12156862745098039, 0.4666666666666667, 0.7058823529411765), (1.0, 0.4980392156862745, 0.054901960784313725), (0.17254901960784313, 0.6274509803921569, 0.17254901960784313), (0.8392156862745098, 0.15294117647058825, 0.1568627450980392), (0.5803921568627451, 0.403921568627451, 0.7411764705882353), (0.5490196078431373, 0.33725490196078434, 0.29411764705882354), (0.8901960784313725, 0.4666666666666667, 0.7607843137254902), (0.4980392156862745, 0.4980392156862745, 0.4980392156862745), (0.7372549019607844, 0.7411764705882353, 0.13333333333333333), (0.09019607843137255, 0.7450980392156863, 0.8117647058823529)]

This is potentially problematic for end-users. MNE-Python we know the default prop_cycle (and everyone seems to use it!) so make use of the fact that we know #7f7f7f is in there, remove it, and create a new cycle. Our code now breaks with:

    self.color_list.remove("#7f7f7f")
ValueError: list.remove(x): x not in list

And yes we should make our check better (e.g., remove any color sufficiently close to the bad color, etc.) but it seems like a potential regression that this behavior has changed in any case. Feel free to close if not!

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.

Direzione di ricerca

Riproduci i due comandi Python per rcParams.get("axes.prop_cycle").by_key()["color"] e ispeziona PR #29808, identificata tramite git bisect, per tracciare la modifica della rappresentazione. Confronta il comportamento attuale con quello precedente, quindi aggiungi una copertura di regressione per il valore pubblico previsto e verifica che il property cycle degli axes rimanga utilizzabile dal codice downstream.

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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.