首页 > 编程知识 正文

python绘制函数曲线,python画函数

时间:2023-05-03 20:10:51 阅读:164024 作者:2840

功能:表示变量趋势的变化。

呼叫签名: PLT.plot(x,y,ls='-',lw=2,label=“plot figure”)

x: x轴上的数值

y: y轴上的数值

)折线图线条样式

)折线图线宽

label :标签映射内容的标签文本

3358 www.Sina.com/importmatplotlib.pyplotaspltimportnumpyasnpx=NP.linspace (0.05,10,1000 ) y=NP.cos(x )

3358 www.Sina.com/# figure for2ddatafrompylabimportplot,showfromsecimport * plot (data [ target==' setosa ',0 ), ' bo ' ) ##data是一个数据集plot(data[target=='versicolor ',0 )、data[target=='Versicolor ',2]、 ' r ' ) ) plot ) data 'g* ' ) show () #figure for all 4D(4)四维) data,同色系,轮为花萼,加花瓣setosa _ sepal _ x=ssx=data 0 ) setosa _ sepal _ y=ssy=data [ target==' setosa ',1 ] setosa _ petal _ x=spx=data [ target=' setosa ' 0 ) Versicolor_sepal_y=vsy=data ) target===1) versi color _ petal _ x=vpx=data (target=' versi color ' ) 2 ) Versicolor_petal_y=vpy=data ) target===3) virgin ICA _ sepal _ x=vgsx=data (target=' virgin ICA ' ) 0 ) virginICA_sepal_y=vgsy=data ) target===1) virgin ICA _ petal _ x=vgpx=data (target=' virgin ICA ' ) ' ro '、vpx、vpy、' r ' ) ) plot ) vgsx、vgsy、' go '、vgpx、vgpy、' g ' ) (show ) ) ) 652

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