Python中的 Matplotlib.axis.Axis.get_minpos()函数
Matplotlib是Python中的一个库,它是 NumPy 库的数值数学扩展。它是Python中用于二维数组图的惊人可视化库,用于处理更广泛的 SciPy 堆栈。
matplotlib.axis.Axis.get_minpos()函数
matplotlib 库的轴模块中的Axis.get_minpos()函数用于获取 minpos。
Syntax: Axis.get_minpos(self)
Parameters: This method does not accepts any parameters.
Return value: This method return the minpos.
以下示例说明了 matplotlib.axis 中的 matplotlib.axis.Axis.get_minpos()函数:
示例 1:
Python3
# Implementation of matplotlib function
from matplotlib.axis import Axis
import matplotlib.pyplot as plt
import numpy as np
X = np.arange(-5, 5, 1)
Y = np.arange(-5, 5, 1)
U, V = np.meshgrid(X, Y)
fig, ax = plt.subplots()
ax.quiver(X, Y, U, V)
w = ax.xaxis.get_minpos()
print("Value Return :\n"+str(w))
fig.suptitle("""matplotlib.axis.Axis.get_minpos()
function Example\n""", fontweight ="bold")
plt.show()
Python3
# Implementation of matplotlib function
from matplotlib.axis import Axis
import numpy as np
import matplotlib.pyplot as plt
fig, ax2 = plt.subplots(sharex = True)
fig.subplots_adjust(left=0.2, wspace=0.6)
box = dict(facecolor='green', pad=5, alpha=0.2)
ax2.plot(20*np.random.rand(10))
ax2.set_xlabel('X - Label', bbox=box)
ax2.set_xlim(0, 10)
Axis.set_label_coords(ax2.xaxis, 0.5, 0.95)
w = ax2.xaxis.get_minpos()
print("Value Return :\n"+str(w))
fig.suptitle("""matplotlib.axis.Axis.get_minpos()
function Example\n""", fontweight ="bold")
plt.show()
输出:
Value Return :
4.0
示例 2:
Python3
# Implementation of matplotlib function
from matplotlib.axis import Axis
import numpy as np
import matplotlib.pyplot as plt
fig, ax2 = plt.subplots(sharex = True)
fig.subplots_adjust(left=0.2, wspace=0.6)
box = dict(facecolor='green', pad=5, alpha=0.2)
ax2.plot(20*np.random.rand(10))
ax2.set_xlabel('X - Label', bbox=box)
ax2.set_xlim(0, 10)
Axis.set_label_coords(ax2.xaxis, 0.5, 0.95)
w = ax2.xaxis.get_minpos()
print("Value Return :\n"+str(w))
fig.suptitle("""matplotlib.axis.Axis.get_minpos()
function Example\n""", fontweight ="bold")
plt.show()
输出:
Value Return :
1.0