import matplotlib.pyplot as plt
#method 1
fig=plt.figure()
x=[1,2,3,4,5,6,7]
y=[1,3,4,2,5,8,6]
#相对于整个figure来说的,形式是百分比
left,bottom,width,height=[0.1,0.1,0.8,0.8]
ax1=fig.add_axes([left,bottom,width,height])
ax1.plot(x,y)
ax1.set_xlabel('xlabel')
ax1.set_ylabel('ylabel')
ax1.set_title('title inside axes')
left,bottom,width,height=[0.2,0.6,0.25,0.25]
ax2=fig.add_axes([left,bottom,width,height])
ax2.plot(y,x)
ax2.set_xlabel('set label')
ax2.set_ylabel('set label')
ax2.set_title("title")
#method 2,直接使用plot
plt.axes([0.6,0.16,0.25,0.25])#[left,bottom,width,height]
plt.plot(x,y,'g')
plt.xlabel('plot xlabel')
plt.ylabel('plot ylabel')
plt.title("title plot")
#plot这个函数是紧跟着上面的(这个是plot的特性,就近跟着最近的plot)
plt.show()