首页 > 编程知识 正文

python内置数学函数库,python自定义函数

时间:2023-05-05 08:53:42 阅读:40732 作者:955

在python中创建了一个相对简单的函数,可用于绘制数据集的时域历史和快速傅立叶变换后数据集的频域响应。 此函数使用命令from pylab import *引入所有必需的功能。 但是,尽管成功编写了这篇文章,我还是得到了警告import * onlyallowedatthemodulelevel。

因此,如果使用命令from pylab import *不是理想的方法,请告诉我如何从pylab正确加载所有必需的功能。 代码附在下面。 另外,函数结束后,有没有关闭图的方法? 我尝试了无法识别子块的plt.close (了吗? ef time _ domain _ plot (目录、标题、X_Label、Y_Label、X_Data、Y_Data ) :

# directory : thepathlengthtothedirectorywheretheoutputfileis

# to be stored

# title : thenameoftheoutputplot,which should end with .eps or .png

# X_Label: The X axis label

# Y_Label: The Y axis label

# x _ data : xaxisdatapoints (usuallytimeatwhichyaxisdatawasacquired

# Y_Data: Y axis data points,usually amplitude

来自py lab导入*

from matplotlib导入rcparams

r params.update ((figure.autolayout ) :true ) )

output _ location=directory.RS trip () Title.rstrip ) )

fig,plt=plt.subplots (

matplotlib.RC('xtick ',labelsize=18 ) )。

matplotlib.RC(ytick ),labelsize=18 ) )。

PLT.set_xlabel(x_label,fontsize=18 ) )。

PLT.set_ylabel(y_label,fontsize=18 ) )。

PLT.plot(x_data,Y_Data,color='red ' ) )

fig.savefig(output_location ) )。

plt.clear (

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。