Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Update plot, remove old data show new data

Đang mở
#542 5 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
20/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
python

Hướng nghiên cứu

Bắt đầu với các entry point _make_empty_graph và _make_graph được nêu trong issue, bao gồm thiết lập FigureCanvasTkAgg và việc dọn dẹp graph_frame. Kiểm tra cách plotting API xử lý việc thay thế một figure hiện có và liệu biểu đồ ban đầu trống được yêu cầu cùng các chỉ báo về sau có được hỗ trợ hay không. Để được xem là hoàn tất, cần có một cách tiếp cận được ghi thành tài liệu và được thống nhất, nhưng chưa xác định file cụ thể nào trong repository hoặc test nào.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Python
Star
4.4k
Fork
677
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của matplotlib/mplfinance

Tất cả issue của matplotlib/mplfinance

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.