编写代码画出下图所示的函数图:
代码如下:
import matplotlib.pyplot as plt
x=[1,2,3,4,5,6,7]
y=[1,3,4,2,5,8,6]
plt.figure()
plt.axes([0.1,0.1,0.8,0.8]) #left=0.1,bottom=0.1,width=0.8,height=0.8
plt.plot(x,y,color='blue')
plt.axes([0.2,0.6,0.25,0.25])
plt.plot(y,x,'green')
plt.axes([0.6,0.2,0.25,0.25])
plt.plot(y[::-1],x,color='purple') #y[::-1]将y逆序
plt.show()