函数Python中的 Matplotlib.axis.Axis.get_url()
Matplotlib是Python中的一个库,它是 NumPy 库的数值数学扩展。它是Python中用于数组二维图的惊人可视化库,用于处理更广泛的 SciPy 堆栈。
Matplotlib.axis.Axis.get_url()函数
matplotlib库的axis模块中的Axis.get_url()函数用于获取url。
Syntax: Axis.get_url(self)
Parameters: This method does not accepts any parameter.
Return value: This method return the url.
下面的示例说明了 matplotlib.axis 中的 matplotlib.axis.Axis.get_url()函数:
示例 1:
Python3
# Implementation of matplotlib function
from matplotlib.axis import Axis
import numpy as np
import matplotlib.pyplot as plt
X = np.arange(-40, 40, 0.5)
Y = np.arange(-40, 40, 0.5)
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( Axis.get_url(ax)),
fontweight ="bold")
fig.suptitle('matplotlib.axis.Axis.get_url() \
function Example\n', fontweight ="bold")
plt.show()
Python3
# Implementation of matplotlib function
from matplotlib.axis import Axis
import matplotlib.pyplot as plt
import numpy as np
fig, 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 = "BuGn",
origin ='lower',
extent =[-3, 3, -3, 3])
ax.set_url('https://www.geeksforgeeks.org/')
ax.set_title("URL : "+str(Axis.get_url(ax)),
fontweight ="bold")
fig.suptitle('matplotlib.axis.Axis.get_url() \
function Example\n', fontweight ="bold")
plt.show()
输出:
示例 2:
Python3
# Implementation of matplotlib function
from matplotlib.axis import Axis
import matplotlib.pyplot as plt
import numpy as np
fig, 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 = "BuGn",
origin ='lower',
extent =[-3, 3, -3, 3])
ax.set_url('https://www.geeksforgeeks.org/')
ax.set_title("URL : "+str(Axis.get_url(ax)),
fontweight ="bold")
fig.suptitle('matplotlib.axis.Axis.get_url() \
function Example\n', fontweight ="bold")
plt.show()
输出: