Wednesday, July 3, 2024
HomeLanguagesPythonmatplotlib.pyplot.ioff() in Python

matplotlib.pyplot.ioff() in Python

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.

matplotlib.pyplot.ioff() Function:

The ioff() function in pyplot module of matplotlib library is used to turn the interactive mode off.

Syntax: matplotlib.pyplot.ioff()

Parameters: This method does not accepts any parameter.

Returns: This method does not return any value.

Below examples illustrate the matplotlib.pyplot.ioff() function in matplotlib.pyplot:

Example #1:




# Implementation of matplotlib function
import matplotlib.pyplot as plt
import numpy as np
  
plt.ioff() 
plt.plot([1.4, 2.5, 0.3])
    
axes = plt.gca() 
axes.plot([3.1, 2.2, 6])
  
plt.title('matplotlib.pyplot.ioff() function Example',
                                   fontweight ="bold")
  
plt.show()


Output:

Example #2:




# Implementation of matplotlib function
import matplotlib.pyplot as plt
import numpy as np
  
plt.ioff() 
random_array = np.arange(-2, 4
line_1 = random_array * 2
line_2 = 10 / (random_array * 2 + 1
figure, axes = plt.subplots() 
    
axes.plot(random_array, line_1, 
          'ro-', random_array, 
          line_2, 'bo-',  
          linestyle ='solid'
    
axes.fill_between(random_array,  
                  line_1,  
                  line_2, 
                  where = line_2>line_1,  
                  interpolate = True
                  color ='green', alpha = 0.4
    
lgnd = axes.legend(['line-1'
                    'line-2'],  
                   loc ='lower center',  
                   shadow = True
    
lgnd.get_frame().set_facecolor('# ffb19a'
plt.title('matplotlib.pyplot.ioff() function Example'
                                    fontweight ="bold")
plt.show()


Output:

Calisto Chipfumbu
Calisto Chipfumbuhttp://cchipfumbu@gmail.com
I have 5 years' worth of experience in the IT industry, primarily focused on Linux and Database administration. In those years, apart from learning significant technical knowledge, I also became comfortable working in a professional team and adapting to my environment, as I switched through 3 roles in that time.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments