Open In App

Matplotlib.axes.Axes.get_visible() in Python

Improve
Improve
Like Article
Like
Save
Share
Report

Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute.

matplotlib.axes.Axes.get_visible() Function

The Axes.get_visible() function in axes module of matplotlib library is used to get the visibility.

Syntax: Axes.get_visible(self)

Parameters: This method does not accepts any parameter.

Returns: This method return the visibility.

Below examples illustrate the matplotlib.axes.Axes.get_visible() function in matplotlib.axes:

Example 1:




# Implementation of matplotlib function
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(ax.get_visible()))
         
fig.suptitle('matplotlib.axes.Axes.get_visible()\
 function Example\n', fontweight ="bold")
  
plt.show()


Output:

Example 2:




# Implementation of matplotlib function
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 :", ax.axis["bottom"].get_visible(),
      "\nTop :", ax.axis["top"].get_visible(),
      "\nLeft :", ax.axis["left"].get_visible(),
      "\nRight :", ax.axis["right"].get_visible())
         
fig.suptitle('matplotlib.axes.Axes.get_visible() \
function Example\n', fontweight ="bold")
  
plt.show()


Output:

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


Last Updated : 30 Apr, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads