import numpy as np
import matplotlib.pyplot as plt
data = np.arange(0,1.1,0.01)
plt.title('lines')
plt.xlabel('x')
plt.ylabel('y')
plt.xlim((0,1))
plt.ylim((0,1))
plt.plot(data,data**2)
plt.plot(data,data**4)
plt.legend(['y=x^2','y=x^4'])
# plt.savefig()
plt.show()
import pandas as pd
#import xlrd
stroke_info = pd.read_excel('D:\python数据分析/healthcare-dataset-stroke.xlsx')
age_abs = pd.read_excel('D:\python数据分析/healthcare-dataset-age_abs.xlsx')
link_outer = pd.merge(stroke_info,age_abs,how='outer',left_on='编号',right_on='编号')
age = link_outer['年龄']
age_nomal = []
for i in age:
if i > 0.0:
age_nomal.append(i)
print(age_nomal)
age_nomal1 = [x for x in age_nomal if x==int(x)]
print(age_nomal1)
x = np.linspace(0,4*np.pi)
print(x)
y=np.sin(x)
plt.plot(x,y,label='$sin(x)$')
plt.title('sin(x)')
plt.xlabel('x')
plt.ylabel('y')
plt.show()
plt.rcParams['lines.linestyle']=':'
plt.rcParams['lines.linewidth']=1.5
plt.rcParams['lines.marker']='h'
plt.plot(x,y,label='$sin(x)$')
plt.title('sin(x)')
plt.xlabel('x')
plt.ylabel('y')
plt.show()