plt.xticks([])
plt.yticks([])
plt.axis('off')
import matplotlib.pyplot as plt
import math
# 生成信号
fs = 1000
f = 10
t = list(range(0, 1000))
t = [x/fs for x in t]
a = [math.sin(2 * math.pi * f * x) for x in t]
# 作图
plt.figure()
plt.subplot(2, 2, 1)
plt.plot(a)
plt.title('Figure-1')
plt.subplot(2, 2, 2)
plt.plot(a)
plt.xticks([])
plt.title('Figure-2')
plt.subplot(2, 2, 3)
plt.plot(a)
plt.yticks([])
plt.title('Figure-3')
plt.subplot(2, 2, 4)
plt.plot(a)
plt.axis('off')
plt.title('Figure-4')
plt.show()
运行结果:
(参考:python 画图工具matplotlib 去掉坐标轴和坐标的方法)