Open In App

Matplotlib.axes.Axes.get_url() 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_url() Function

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

Syntax: Axes.get_url(self)

Parameters: This method does not accepts any parameter.

Returns: This method return the url.

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

Example 1:




# Implementation of matplotlib function  
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
   
  
f, ax = plt.subplots()
ax.scatter([1, 2, 3], [4, 5, 6])
ax.set_url('http://www.google.com')
f.canvas.print_figure('scatter.svg')
  
ax.text(1.5, 5.5, "URL : "
        + str( ax.get_url()), 
        fontweight ="bold")
  
f.suptitle('matplotlib.axes.Axes.get_url() \
function Example\n', fontweight ="bold")
  
plt.show()


Output:

Example 2:




# Implementation of matplotlib function  
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
  
  
f, ax = plt.subplots()
delta = 0.025
  
x = y = np.arange(-3.0, 3.0, delta)
X, Y = np.meshgrid(x, y)
  
Z1 = np.exp(-X**2 - Y**2)
Z2 = np.exp(-(X - 1)**2 - (Y - 1)**2)
Z = (Z1 - Z2) * 2
   
ax.imshow(Z, interpolation ='bilinear'
          cmap = cm.gray,
          origin ='lower',
          extent =[-3, 3, -3, 3])
   
f.savefig('image.svg')
  
ax.set_title("URL : "+str(ax.get_url()), fontweight ="bold")
  
f.suptitle('matplotlib.axes.Axes.get_url() function \
Example\n', fontweight ="bold")
  
plt.show()


Output:



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