如何为seaborn编写Python 3的装饰程序
因为我需要调用如何为seaborn编写Python 3的装饰程序,python,python-3.x,seaborn,Python,Python 3.x,Seaborn,因为我需要调用sns.lineplot和sns.edcfplot进行绘图。如何生成装饰器,以便每次我只需输入sns.lineplot或sns.edcfplot即可保存图形 import matlab.pyplot as plt import seaborn as sns flights = sns.load_dataset("flights") data = flights.query("month == 'May'") plt.figure() f
sns.lineplot
和sns.edcfplot
进行绘图。如何生成装饰器,以便每次我只需输入sns.lineplot
或sns.edcfplot
即可保存图形
import matlab.pyplot as plt
import seaborn as sns
flights = sns.load_dataset("flights")
data = flights.query("month == 'May'")
plt.figure()
fig=sns.lineplot(data=data, x="year", y="passengers")
fig.save("./fig.png")