Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Matplotlib.artist.Artist.get_visible() in Python

  • Last Updated : 10 May, 2020

Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. The Artist class contains Abstract base class for objects that render into a FigureCanvas. All visible elements in a figure are subclasses of Artist.

matplotlib.artist.Artist.get_visible() method

 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

The get_visible() method in artist module of matplotlib library is used to get the visibility.

Syntax: Artist.get_visible(self)



Parameters: This method does not accepts any parameter.

Returns: This method return the visibility.

Below examples illustrate the matplotlib.artist.Artist.get_visible() function in matplotlib:

Example 1:




# Implementation of matplotlib function
from matplotlib.artist import Artist  
import matplotlib.pyplot as plt 
from mpl_toolkits.axisartist.axislines import Subplot 
      
    
fig, ax = plt.subplots() 
    
ax.plot([1, 2, 34, 67, 43, 5, 8]) 
    
ax.set_title("Visibility : " +str(Artist.get_visible(ax)))
  
  
fig.suptitle('matplotlib.artist.Artist.get_visible()\
function Example', fontweight ="bold"
  
plt.show()

Output:

Example 2:




# Implementation of matplotlib function
from matplotlib.artist import Artist  
import numpy as np 
import matplotlib.pyplot as plt 
from mpl_toolkits.axisartist.axislines import Subplot 
      
  
fig = plt.figure() 
      
ax = Subplot(fig, 111
fig.add_subplot(ax) 
           
X = np.arange(-20, 20, 0.5
Y = np.arange(-20, 20, 0.5
U, V = np.meshgrid(X, Y) 
       
ax.quiver(X, Y, U, V) 
    
ax.axis["bottom"].set_visible(False
ax.axis["top"].set_visible(False
      
print("Visibilities of Axis"
print("Bottom :", Artist.get_visible(ax.axis["bottom"]), 
      "\nTop :", Artist.get_visible(ax.axis["top"]), 
      "\nLeft :", Artist.get_visible(ax.axis["left"]), 
      "\nRight :", Artist.get_visible(ax.axis["right"]))
  
fig.suptitle('matplotlib.artist.Artist.get_visible()\
function Example', fontweight ="bold"
  
plt.show()

Output:

Visibilities of Axis
Bottom : False 
Top : False 
Left : True 
Right : True



My Personal Notes arrow_drop_up
Recommended Articles
Page :