Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Update plot, remove old data show new data

Abierto
#542 5 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
20/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
python

Línea de trabajo

Comience por los puntos de entrada _make_empty_graph y _make_graph mostrados en el issue, incluida la configuración de FigureCanvasTkAgg y la limpieza de graph_frame. Compruebe cómo la API de gráficos gestiona la sustitución de una figura existente y si admite el gráfico inicial vacío solicitado y los indicadores posteriores. Para darlo por terminado sería necesario un enfoque documentado y acordado, pero no se identifica ningún archivo específico del repositorio ni ninguna prueba.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Python
Estrellas
4.4k
Forks
678
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de matplotlib/mplfinance

Todos los issues de matplotlib/mplfinance

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.