![]() |
Reiszing figure to occupy entire frame - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Reiszing figure to occupy entire frame (/thread-35984.html) |
Reiszing figure to occupy entire frame - fishbackp - Jan-06-2022 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. |