You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
matplotlib/网工2班202014050211张欣.py

24 lines
480 B

import numpy as np
import matplotlib.pyplot as plt
fig,ax = plt.subplots()
#配置中文显示
plt.rcParams['font.family'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
def f(t):
return np.cos(2*np.pi*t)
x1 = np.arange(0.0,4.0,0.5)
x2 = np.arange(0.0,4.0,0.01)
plt.figure(1)
plt.subplot(2,2,1)
plt.plot(x1,f(x1),'bo',x2,f(x2),'k')
plt.title('子图1')
plt.subplot(2,2,2)
plt.plot(np.cos(2*np.pi*x2),'r--')
plt.title('子图2')
plt.show()