Matplotlib.figure.Figure.set_canvas() in Python Last Updated : 03 May, 2020 Comments Improve Suggest changes Like Article Like Report Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. The figure module provides the top-level Artist, the Figure, which contains all the plot elements. This module is used to control the default spacing of the subplots and top level container for all plot elements. matplotlib.figure.Figure.set_canvas() method The set_canvas() method figure module of matplotlib library is used to set the canvas that contains the figure. Syntax: set_canvas(self, canvas) Parameters: This method accept the following parameters that are discussed below: canvas : This parameter is the FigureCanvas. Returns: This method returns the axes. Below examples illustrate the matplotlib.figure.Figure.set_canvas() function in matplotlib.figure: Example 1: Python3 1== # Implementation of matplotlib function import matplotlib.pyplot as plt def new_figure(): fig = plt.figure() plt.plot([0, 1], [2, 3]) plt.close(fig) return fig def show_figure(fig): dummy = plt.figure() new_manager = dummy.canvas.manager new_manager.canvas.figure = fig fig.set_canvas(new_manager.canvas) fig = new_figure() show_figure(fig) fig.suptitle("""matplotlib.figure.Figure.set_canvas() function Example\n\n""", fontweight ="bold") plt.show() Output: Example 2: Python3 1== # Implementation of matplotlib function import numpy as np import matplotlib.pyplot as plt x = np.arange(16) y = np.sin(x / 3) fig, ax = plt.subplots() ax.step(x, y + 2, color ='green') ax.plot(x, y + 2, 'o--', color ='black', alpha = 0.3) def show_figure(fig): dummy = plt.figure() new_manager = dummy.canvas.manager new_manager.canvas.figure = fig fig.set_canvas(new_manager.canvas) show_figure(fig) fig.suptitle("""matplotlib.figure.Figure.set_canvas() function Example\n\n""", fontweight ="bold") plt.show() Output: Comment More infoAdvertise with us Next Article Matplotlib.figure.Figure.set_canvas() in Python S SHUBHAMSINGH10 Follow Improve Article Tags : Python Python-matplotlib Matplotlib figure-class Practice Tags : python Similar Reads Matplotlib.figure.Figure.set_dpi() in Python Matplotlib is a library in Python and it is numerical â mathematical extension for NumPy library. The figure module provides the top-level Artist, the Figure, which contains all the plot elements. This module is used to control the default spacing of the subplots and top level container for all plot 2 min read Matplotlib.figure.Figure.text() in Python Matplotlib is a library in Python and it is numerical â mathematical extension for NumPy library. The figure module provides the top-level Artist, the Figure, which contains all the plot elements. This module is used to control the default spacing of the subplots and top level container for all plot 2 min read Matplotlib.figure.Figure.sca() in Python Matplotlib is a library in Python and it is numerical â mathematical extension for NumPy library. The figure module provides the top-level Artist, the Figure, which contains all the plot elements. This module is used to control the default spacing of the subplots and top level container for all plot 1 min read Matplotlib.figure.Figure.clear() in Python Matplotlib is a library in Python and it is numerical â mathematical extension for NumPy library. The figure module provides the top-level Artist, the Figure, which contains all the plot elements. This module is used to control the default spacing of the subplots and top level container for all plot 1 min read Matplotlib.figure.Figure.clf() in Python Matplotlib is a library in Python and it is numerical â mathematical extension for NumPy library. The figure module provides the top-level Artist, the Figure, which contains all the plot elements. This module is used to control the default spacing of the subplots and top level container for all plot 1 min read Like