Python中的 Matplotlib.artist.Artist.get_agg_filter()
Matplotlib是Python中的一个库,它是 NumPy 库的数值数学扩展。 Artist 类包含呈现为 FigureCanvas 的对象的 Abstract 基类。图中所有可见元素都是 Artist 的子类。
Matplotlib.artist.Artist.get_agg_filter() 方法
matplotlib 库的 Artist 模块中的get_agg_filter() 方法用于获取用于 agg 过滤器的过滤器函数。
Syntax: Artist.get_agg_filter(self)
Parameters: This method does not accepts any parameter.
Returns: This method return filter function to be used for agg filter.
下面的示例说明了 matplotlib.artist.Artist。 matplotlib 中的get_agg_filter ()函数:
示例 1:
# Implementation of matplotlib function
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.artist import Artist
xx = np.random.rand(16, 30)
fig, axs = plt.subplots()
m = axs.pcolor(xx)
m.set_zorder(-20)
# use of get_agg_filter() method
val = Artist.get_agg_filter(axs)
axs.set_title("Value Return by get_agg_filter(): "
+ str(val))
fig.suptitle('matplotlib.artist.Artist.get_agg_filter() \
function Example', fontweight="bold")
plt.show()
输出:
示例 2:
# Implementation of matplotlib function
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.artist import Artist
np.random.seed(10**7)
geeks = np.random.randn(40)
fig, axs = plt.subplots()
axs.acorr(geeks, usevlines=True, normed=True,
maxlags=30, lw=2)
axs.grid(True)
# use of get_agg_filter() method
val = Artist.get_agg_filter(axs)
axs.set_title("Value Return by get_agg_filter(): "
+ str(val))
fig.suptitle('matplotlib.artist.Artist.get_agg_filter() \
function Example', fontweight="bold")
plt.show()
输出: