Jan-06-2022, 10:33 PM
I have a frame within my root window and wish to place a plot inside the frame. What I have so far is the following:
from tkinter import Tk,Frame,TOP,BOTH from matplotlib import pyplot as plt from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg import numpy as np plt.rcParams["figure.figsize"] = [18,10] root=Tk() root.wm_title("Root Window") root.geometry('1500x1000') x = np.linspace(0, 2 * np.pi, 400) y = np.sin(x ** 2) fig, ax = plt.subplots() ax.plot(x, y) canvas_frame=Frame(root,bg='yellow') canvas_frame.pack(side=TOP,expand=True) canvas = FigureCanvasTkAgg(fig, master=canvas_frame) canvas.get_tk_widget().pack(side=TOP,fill=BOTH,expand=True) canvas.draw() root.mainloop()The problem I have is that I want to increase the plot size so it occupies the entire frame. I'm unsure why adjusting plt.rcParams doesn't do what I need.