Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何为seaborn编写Python 3的装饰程序_Python_Python 3.x_Seaborn - Fatal编程技术网

如何为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")