Matplotlib.axis.XAxis.get_url() in function Python
Last Updated :
10 Jun, 2020
Improve
Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. It is an amazing visualization library in Python for 2D plots of arrays and used for working with the broader SciPy stack.
Python3 1==
Output:
Example 2:
Python3 1==
Output:
Matplotlib.axis.XAxis.get_url() Function
The XAxis.get_url() function in axis module of matplotlib library is used to get the url.Syntax: XAxis.get_url(self) Parameters: This method does not accepts any parameter. Return value: This method return the url.Example 1:
# Implementation of matplotlib function
from matplotlib.axis import XAxis
import numpy as np
import matplotlib.pyplot as plt
X = np.arange(-60, 55, 0.4)
Y = np.arange(-60, 40, 0.4)
U, V = np.meshgrid(X, Y)
fig, ax = plt.subplots()
ax.plot(U, V)
ax.set_url('http://www.google.com')
fig.canvas.print_figure('scatter.svg')
ax.text(1.5, 5.5, "URL : "
+ str( XAxis.get_url(ax)),
fontweight ="bold")
fig.suptitle('matplotlib.axis.XAxis.get_url() function\
Example\n', fontweight ="bold")
plt.show()

# Implementation of matplotlib function
from matplotlib.axis import XAxis
import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots()
delta = 0.25
x = y = np.arange(-4.0, 5.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 = "BuGn",
origin ='lower',
extent =[-3, 3, -3, 3])
ax.set_url('https://www.geeksforgeeks.org/')
ax.set_title("URL : "+str(XAxis.get_url(ax)),
fontweight ="bold")
fig.suptitle('matplotlib.axis.XAxis.get_url() \
function Example\n', fontweight ="bold")
plt.show()
