python 抠图 锯齿
Antialiasing is another important feature of Matplotlib and in this article, we will review how to use this functionality. pyplot.antialiased() is an inbuilt function in matplotlib.pyplot which performs our required operation.
抗锯齿是Matplotlib的另一个重要功能,在本文中,我们将介绍如何使用此功能。 pyplot.antialiased()是matplotlib.pyplot中的内置函数,它执行我们所需的操作。
Syntax:
句法:
line, = plt.plot(x, y, '-')
line.set_antialiased(False) # turn off antialiasing
绘图中抗锯齿的Python代码 (Python code for antialiasing in plotting)
# Data Visualization using Python
# Antialiasing
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(50)
y = 60 + np.random.randint(50,70,50)
plt.figure()
plt.title('Antialiased OFF')
line, = plt.plot(x, y)
# turn off antialiasing
line.set_antialiased(False)
plt.figure()
plt.title('Antialiased ON')
line, = plt.plot(x, y)
# turn on antialiasing
line.set_antialiased(True)
Output:
输出:
Output is as figure
翻译自: https://www.includehelp.com/python/antialiasing-in-plotting.aspx
python 抠图 锯齿