Python中的 Matplotlib.artist.Artist.is_transform_set()
Matplotlib是Python中的一个库,它是 NumPy 库的数值数学扩展。 Artist 类包含呈现为 FigureCanvas 的对象的 Abstract 基类。图中所有可见元素都是 Artist 的子类。
Matplotlib.artist.Artist.is_transform_set() 方法
matplotlib 库的 Artist 模块中的is_transform_set() 方法用于获取 Artist 是否具有显式设置的变换。
Syntax: Artist.is_transform_set(self)
Parameters: This method does not accepts any parameter.
Returns: This method return whether the Artist has an explicitly set transform.
下面的示例说明了 matplotlib 中的 matplotlib.artist.Artist.is_transform_set()函数:
示例 1:
# Implementation of matplotlib function
from matplotlib.artist import Artist
import matplotlib.pyplot as plt
fig, axs = plt.subplots()
axs.plot([1, 2, 3])
axs.set_title("Is artist is explicitly set transform : "
+str(Artist.is_transform_set(axs)))
fig.suptitle("""matplotlib.artist.Artist.is_transform_set()
function Example""", fontweight="bold")
plt.show()
输出:
示例 2:
# Implementation of matplotlib function
from matplotlib.artist import Artist
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.4, 0.5),
xycoords ='axes fraction',
va ='center')
axs.set_title("Is artist is explicitly set transform : "
+str(Artist.is_transform_set(axs)))
fig.suptitle("""matplotlib.artist.Artist.is_transform_set()
function Example""", fontweight="bold")
plt.show()
输出: