Python中的 Matplotlib.axis.Axis.is_transform_set()函数
Matplotlib是Python中的一个库,它是 NumPy 库的数值数学扩展。它是Python中用于二维数组图的惊人可视化库,用于处理更广泛的 SciPy 堆栈。
matplotlib.axis.Axis.is_transform_set()函数
matplotlib 库的轴模块中的Axis.is_transform_set()函数用于获取 Artist 是否具有显式设置的变换。
Syntax: Axis.is_transform_set(self)
Parameters: This method does not accepts any parameter.
Return value: This method return whether the Artist has an explicitly set transform.
下面的示例说明了 matplotlib.axis 中的 matplotlib.axis.Axis.is_transform_set()函数:
示例 1:
Python3
# Implementation of matplotlib function
from matplotlib.axis import Axis
import matplotlib.pyplot as plt
fig, axs = plt.subplots()
axs.plot([1, 2, 3])
axs.set_title("Is artist is explicitly set transform : "
+str(Axis.is_transform_set(axs)))
fig.suptitle('matplotlib.axis.Axis.is_transform_set() \
function Example\n', fontweight ="bold")
plt.show()
Python3
# Implementation of matplotlib function
from matplotlib.axis import Axis
import matplotlib.pyplot as plt
fig, (axs, axs2) = plt.subplots(2, 1)
gs = axs2.get_gridspec()
axbig = fig.add_subplot(gs[1:, -1])
axbig.annotate("Second Axes", (0.5, 0.6),
xycoords ='axes fraction',
va ='center')
axs.set_title("Is artist is explicitly set transform : "
+str(Axis.is_transform_set(axs)))
fig.suptitle('matplotlib.axis.Axis.is_transform_set() \
function Example\n', fontweight ="bold")
plt.show()
输出:
示例 2:
Python3
# Implementation of matplotlib function
from matplotlib.axis import Axis
import matplotlib.pyplot as plt
fig, (axs, axs2) = plt.subplots(2, 1)
gs = axs2.get_gridspec()
axbig = fig.add_subplot(gs[1:, -1])
axbig.annotate("Second Axes", (0.5, 0.6),
xycoords ='axes fraction',
va ='center')
axs.set_title("Is artist is explicitly set transform : "
+str(Axis.is_transform_set(axs)))
fig.suptitle('matplotlib.axis.Axis.is_transform_set() \
function Example\n', fontweight ="bold")
plt.show()
输出: