我正在用 python 绘制一个简单的指数衰减 cos 曲线图。代码在下面,实际运行的代码没有问题,我只是想知道是否有办法改变 python 显示图形的方式,而不是像这样被轴包围 this它有类似 this 的轴.这不是一个紧急的问题,只是为了让剧情更贴近我报告的其他部分。
import matplotlib as mpl
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
t = np.linspace(0, 4, 10000)
r=1
x = t
y = r * np.exp(-t)*np.cos(10*t)
plt.plot(x,y,'-')
plt.plot(x,np.zeros(10000),'k-')
plt.show()
请您参考如下方法:
看看 Axis line style demo来自 matplotlib 画廊。
具体来说,行:
ax = SubplotZero(fig, 111)
...
for direction in ["left", "right", "bottom", "top"]:
ax.axis[direction].set_visible(False)
