Friday, September 5, 2025
HomeLanguagesMatplotlib.artist.Artist.get_visible() in Python

Matplotlib.artist.Artist.get_visible() in Python

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

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
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32264 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6634 POSTS0 COMMENTS
Nicole Veronica
11801 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11863 POSTS0 COMMENTS
Shaida Kate Naidoo
6750 POSTS0 COMMENTS
Ted Musemwa
7025 POSTS0 COMMENTS
Thapelo Manthata
6701 POSTS0 COMMENTS
Umr Jansen
6718 POSTS0 COMMENTS