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