import numpy as np
import matplotlib.pyplot as plt
from matplotlib.image import imread
img=imread(r"E:\\私藏壁纸\\海滩.jpg")
plt.imshow(img)
plt.show()
import numpy as np
import matplotlib.pyplot as plt
x=np.arange(0,6,0.1) #以0.1为单位,生成0-6的数据
y=np.sin(x)
z=np.cos(x)
plt.plot(x,y,label="sin")
plt.plot(x,z,label="cos",linestyle="--")
plt.title("sin&cos")
plt.xlabel("x")
plt.ylabel("y")
plt.legend(loc="best",facecolor="blue",edgecolor="red")
plt.show()
显示相应的图片
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.image import imread
img=imread(r"E:\\私藏壁纸\\海滩.jpg")
plt.imshow(img)
plt.show()