- 积分
- 16
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2020-11-11
- 最后登录
- 1970-1-1
![未绑定新浪微博用户 新浪微博达人勋](source/plugin/sina_login/img/gray.png)
|
发表于 2022-3-23 17:13:36
|
显示全部楼层
no viable alternative at input 'label',老师命令栏出现这种是什么原因呢。
fn=os.path.join('E:\MeteoInfo\sample\ASCIIL\skincancer.txt')
df=DataFrame.read_table(fn,format='%s%f%2i%f')
lat=df['lat'].values
mort=df['Mort'].values
slope,intercept,r,p,std_eer=stats.linregress(lat,mort)
scatter(lat,mort,label='original data',edge=False)
plot(lat,intercept+slope*lat,'r'label='fitted line')
text(29,100,r'$\hat{y}='+'%.2f'% slope+'x+'+\
'%.1f'% intercept+'$',fontsize=16)
text(29,88,r'$R^2='+'%.4f'%(r**2)+'$',fontsize=16)
legend()
xlim(27,50)
ylim(75,250)
xticks(arange(30,51,5))
yticks(arange(100,226,25))
title('Skin Cancer Mortality versus State Latitude')
xlabel('Latitude(at center of State)'
ylabel('Mortality(Deaths per 10 million)') |
|