Matplotlib.axes.Axes.set_url() in Python

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




