Matplotlib.pyplot.get_current_fig_manager() in Python
Last Updated :
10 May, 2020
Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, etc.
matplotlib.pyplot.get_current_fig_manager() method
The get_current_fig_manager() method in pyplot module of matplotlib library is used to get the figure manager of the current figure.
Syntax: matplotlib.pyplot.get_current_fig_manager()
Parameters: This method does not accept any parameters.
Returns: This method returns the figure manager of the current figure.
Below examples illustrate the matplotlib.pyplot.get_current_fig_manager() function in matplotlib.pyplot:
Example 1:
import matplotlib.pyplot as plt
import numpy as np
X = np.arange( - 10 , 10 , 0.5 )
Y = np.arange( - 10 , 10 , 0.5 )
U, V = np.meshgrid(X, Y)
fig, ax = plt.subplots()
ax.quiver(X, Y, U, V)
ax.invert_xaxis()
w = plt.get_current_fig_manager()
print ( "Value Return by get_current_fig_manager():" )
print (w)
fig.suptitle('matplotlib.pyplot.get_current_fig_manager() \
function Example', fontweight = "bold" )
plt.show()
|
Output:
Value Return by get_current_fig_manager():
<matplotlib.backends._backend_tk.FigureManagerTk object at 0x07BE6470>
Example 2:
import numpy as np
import matplotlib.pyplot as plt
xx = np.random.rand( 16 , 30 )
fig, ax = plt.subplots()
m = ax.pcolor(xx)
m.set_zorder( - 20 )
w = plt.get_current_fig_manager()
print ( "Value Return by get_current_fig_manager():" )
print (w)
fig.suptitle('matplotlib.pyplot.get_current_fig_manager()\
function Example', fontweight = "bold" )
plt.show()
|
Output:
Value Return by get_current_fig_manager():
<matplotlib.backends._backend_tk.FigureManagerTk object at 0x08725490>
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...