'Update canvas fig embedded in tkinter window when fig carried out from mplfinance. How I can update fig in tkinter window
Update canvas fig embedded in tkinter window when fig carried out from mplfinance. How I can update fig in tkinter window '''from tkinter import *
import datetime as dt
import yfinance as yf
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg, NavigationToolbar2Tk)
import mplfinance as mpf
gui = Tk()
gui.geometry("800x700")
stock = 'SPY'
end = dt.datetime.now()
start = end - dt.timedelta(days=6)
df = yf.download(stock.upper(), start, end, interval = '5m')
def Plot_data(type='candle', grid= '-', style='nightclouds'):
fig = plt.Figure(figsize=(7,5), dpi=100)
chart = fig.add_subplot(111)
chart_canvas = FigureCanvasTkAgg(fig, master=gui)
chart_canvas.get_tk_widget().place(relx = .05, rely=.25)
s = mpf.make_mpf_style(base_mpf_style=style, gridstyle=grid)
mpf.plot(df, ax= chart, type = type, style = s)
Plot_data()
mainloop()'''
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
