python 【matplotlib】

1 import matplotlib.pyplot as plt
2 
3 data = [5, 20, 15, 25, 10,100,88]
4 
5 plt.bar(range(len(data)), data)
6 plt.show()


//坐标图

import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(0, 10, 1000)
y = np.sin(x)
z = np.cos(x**2)

plt.figure(figsize=(8,4))
plt.plot(x,y,label="$sin(x)$",color="red",linewidth=2)
plt.plot(x,z,"b--",label="$cos(x^2)$")
plt.xlabel("Time(s)")
plt.ylabel("Volt")
plt.title("PyPlot First Example")
plt.ylim(-1.2,1.2)
plt.legend()
plt.show()

 

posted @ 2018-03-25 07:08  Justice-V  阅读(87)  评论(0)    收藏  举报