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

Update plot, remove old data show new data

Aperta
#542 5 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
20/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
python

Direzione di ricerca

Iniziare dagli entry point _make_empty_graph e _make_graph mostrati nell’issue, includendo la configurazione di FigureCanvasTkAgg e la pulizia di graph_frame. Verificare come l’API di plotting gestisce la sostituzione di una figure esistente e se sono supportati il grafico iniziale vuoto richiesto e gli indicatori successivi. Per considerarlo completato sarebbe necessario un approccio documentato e concordato, ma non è identificato alcun file specifico del repository né alcun test.

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

Descrizione

question

Thanks for an amazing library!

I'm trying to create an application where the user can select a ticker and then click a button that prints candlesticks for the ticker. I'm plotting the graph inside a frame in Tkinter.

image

The user can select a ticker in the drop down and Graph the data for the ticker.

image

I first create the empty graph

def _make_empty_graph(self):

    self.fig = mpf.figure()     
    self.canvas = FigureCanvasTkAgg(self.fig, self.graph_frame)
    self.canvas.get_tk_widget().pack()

I then create the graph with data from a dataframe, after the user has selected a ticker and clicked "Graph". I destroy the children in the frame to not add another graph under the previous graph. The user can then select yet another ticker and graph it.

def _make_graph(self, ticker_data=None):

    self._get_ticker_data()

    for widgets in self.graph_frame.winfo_children():
        widgets.destroy()

    self.fig, _ = mpf.plot(self.ticker_df, type='candle', 
        title = f'{self.ticker_var.get()}',
        volume=True, style='binance', returnfig=True)


    self.canvas = FigureCanvasTkAgg(self.fig, self.graph_frame)
    self.canvas.get_tk_widget().pack()

Can I solve this a bit more elegant by using subplots or similar and then just clear the graph before I create the new graph? I still want to show an empty graph in the beginning. Do I need to create the empty graph in some other way to be able to update it later? Later on I like to add buttons to be able to RSI, Bollinger bands etc. on top the candlesticks.

Suggestions are greatly appreciated.

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.