Skip to content
Related Articles

Related Articles

Improve Article

Matplotlib.pyplot.get_current_fig_manager() in Python

  • Last Updated : 10 May, 2020
Geek Week

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>

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course




My Personal Notes arrow_drop_up
Recommended Articles
Page :