Matplotlib.artist.artist.axes()
Python matplotlib库中artist模块的axes()属性是艺术家所在的Axes实例,或者是无。
属性: Artist.axes
下面的例子说明了matplotlib中的matplotlib.artist.artist.axes()属性:
示例1
# Implementation of matplotlib function
from matplotlib.artist import Artist
import matplotlib.pyplot as plt
# providing values to x and y
x = [8, 5, 11, 13, 16, 23]
y = [14, 8, 21, 7, 12, 15]
# to plot x and y
plt.plot(x, y)
# use of axes() property
axs = Artist.axes
plt.text(8.5, 14, str(axs), fontweight="bold")
plt.title("""matplotlib.artist.Artist.axes()
property Example""", fontweight="bold")
plt.show()
输出:
示例2
# Implementation of matplotlib function
from matplotlib.artist import Artist
import matplotlib.pyplot as plt
# providing values to x and y
x = [8, 5, 11, 13, 16, 23]
y = [14, 8, 21, 7, 12, 15]
# to plot x and y
plt.plot(x, y)
plt.axes(facecolor = 'black')
axs = Artist.axes
print(str(axs))
plt.title("""matplotlib.artist.Artist.axes()
property Example""", fontweight="bold")
plt.show()
输出: