Matplotlib.axes.Axes.set_url() in Python
Last Updated : 30 Apr, 2020
Improve
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.The Axes.set_url() function in axes module of matplotlib library is used to set the url for the artist.Python3 Output:
Example-2:Python3 Output: 
matplotlib.axes.Axes.set_url() Function
Syntax: Axes.set_url(self, url) Parameters: This method accepts only one parameters.Below examples illustrate the matplotlib.axes.Axes.set_url() function in matplotlib.axes: Example 1:Returns: This method does not return any value.
- url : This parameter is the string containing the url.
# 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()
s = ax.scatter([1, 2, 3], [4, 5, 6])
s.set_url('http://www.google.com')
f.canvas.print_figure('scatter.svg')
f.suptitle('matplotlib.axes.Axes.set_url() function\
Example\n', fontweight ="bold")
plt.show()

# 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
im = ax.imshow(Z, interpolation ='bilinear',
cmap = cm.gray,
origin ='lower',
extent =[-3, 3, -3, 3])
im.set_url('https://www.geeksforgeeks.org/')
f.savefig('image.svg')
f.suptitle('matplotlib.axes.Axes.set_url() function \
Example\n', fontweight ="bold")
plt.show()
