Open In App

Matplotlib.pyplot.get_current_fig_manager() in Python

Last Updated : 10 May, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

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:




# Implementation of matplotlib function
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:




# Implementation of matplotlib function  
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

Similar Reads