I have a Canvas class that inherits from the FigureCanvas class in Matplotlib.
from matplotlib.backends.backend_qt5agg import FigureCanvas
class Canvas(FigureCanvas):
def __init__(self):
fig = Figure(figsize=(5, 3))
super().__init__(fig)
And I display canvas figures in the PyQt5 window. The canvas size changes depending on the size of the window. When I print these canvases, it always prints at the current size of the canvas (solutions in How do I change the size of figures drawn with Matplotlib? and Specify figure size in centimeter in matplotlib do not work).
However, I would like to print them in a fixed size, no matter what the current size is. As far as I could tell from the internet, I cannot specify size in print_figure()
function. How can I print all the figures at the fixed size?