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

The use of `returnfig=True` creates multiple figures when using ipywidgets

Aperta
#673 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
jupyter, matplotlib, python

Direzione di ricerca

Riproduci il problema in JupyterLab usando la plot_func mostrata con ipywidgets, mplfinance e returnfig=True. Inizia osservando la creazione delle figure quando gli slider vengono aggiornati, quindi segui il punto di ingresso del plotting e la gestione delle figure. Il lavoro è completato quando aggiornamenti ripetuti del widget lasciano solo il plot corrente invece di aggiungere figure.

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

Descrizione

bug

Describe the bug
If you provide returnfig=True or use your own axes, updating the ipywidgets produces additional plots.

To Reproduce
this example uses 15 min klines, but that doesn't matter.

@interact(
        start_pos = widgets.FloatSlider(value=0, max=len(df.index) - 1 - 7 * 96, min=0, step=1),
        length    = widgets.FloatSlider(value=7 * 96, max=7 * 96, min=96, step=96),
        
        )
def plot_func(start_pos, length):
    start_pos, length = int(start_pos), int(length)
    ldf = df.iloc[start_pos:start_pos + length]
    print(ldf.index[0], ' - ', ldf.index[-1])
    mpf.plot(ldf, style='yahoo', figsize=(20,5), returnfig=True)
    #print([ str(ax) for ax in axlist])

Expected behavior
When using ipywidgets and updateing the slider, the reloading of the plot_func produces an additional figure each time you update the widget. This shouldn't be. When your don't use returnfig (or don't add ax and volume by your own figure) this behaviour does not accure.

jupyter lab
mplfinance 0.12.10b0

Screenshots
image

Lingua principale
Python
Stelle
4.4k
Fork
678
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

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 matplotlib/mplfinance

Tutte le issue di matplotlib/mplfinance

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.