Friday, September 26, 2025
HomeLanguagesMatplotlib.artist.Artist.set_visible() in Python

Matplotlib.artist.Artist.set_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.set_visible() method

The set_visible() method in artist module of matplotlib library is used to set the artist’s visibility.

Syntax: Artist.set_visible(self, b)

Parameters: This method accepts the following parameters.

  • b: This parameter is the boolean value.

Returns: This method does not return any value.

Below examples illustrate the matplotlib.artist.Artist.set_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 = plt.figure() 
     
ax = Subplot(fig, 111
fig.add_subplot(ax) 
  
Artist.set_visible(ax.axis["left"], False
Artist.set_visible(ax.axis["top"], False
  
fig.suptitle('matplotlib.artist.Artist.set_visible()\
function Example', fontweight ="bold"
  
plt.show()


Output:

Example 2:




# Implementation of matplotlib function
from matplotlib.artist import Artist  
import matplotlib.pyplot as plt 
import numpy as np
  
  
X = np.arange(-20, 20, 0.5
Y = np.arange(-20, 20, 0.5
U, V = np.meshgrid(X, Y) 
      
fig, ax = plt.subplots() 
ax.quiver(X, Y, U, V) 
w = ax.get_xaxis()
  
Artist.set_visible(w, False)
  
fig.suptitle('matplotlib.artist.Artist.set_visible()\
function Example', fontweight ="bold"
  
plt.show()


Output:

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32321 POSTS0 COMMENTS
Milvus
84 POSTS0 COMMENTS
Nango Kala
6683 POSTS0 COMMENTS
Nicole Veronica
11856 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11910 POSTS0 COMMENTS
Shaida Kate Naidoo
6799 POSTS0 COMMENTS
Ted Musemwa
7072 POSTS0 COMMENTS
Thapelo Manthata
6759 POSTS0 COMMENTS
Umr Jansen
6762 POSTS0 COMMENTS