import numpy as np
import matplotlib.pyplot as plt


def f(t):
return np.exp(-t) * np.cos(2*np.pi*t)


t1 = np.arange(0.0, 3.0, 0.01)

ax1 = plt.subplot(212)
#ax1.margins(0.05) # Default margin is 0.05, value 0 means fit
ax1.plot(t1, f(t1), 'k')

ax2 = plt.subplot(221)
#ax2.margins(2, 2) # Values >0.0 zoom out
ax2.plot(t1, f(t1), 'r')
ax2.set_title('Zoomed out')

ax3 = plt.subplot(222)
#ax3.margins(x=0, y=-0.25) # Values in (-0.5, 0.0) zooms in to center
ax3.plot(t1, f(t1), 'g')
ax3.set_title('Zoomed in')

plt.show()

 

相关文章:

  • 2021-07-22
  • 2022-12-23
  • 2021-06-12
  • 2021-12-14
  • 2021-08-18
  • 2022-12-23
  • 1970-01-01
  • 2022-12-23
猜你喜欢
  • 2021-07-13
  • 2022-12-23
  • 2021-05-31
  • 2021-08-30
  • 2021-11-23
  • 2022-12-23
  • 2021-12-12
相关资源
相似解决方案