반응형
Recent Posts
Recent Comments
관리 메뉴

개발잡부

[matplotlib] two subplot chart sample 1 본문

Python/matplotlib

[matplotlib] two subplot chart sample 1

닉의네임 2022. 8. 19. 14:47
반응형
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, 5.0, 0.1)
t2 = np.arange(0.0, 5.0, 0.02)

plt.figure()
plt.subplot(211)
plt.plot(t1, f(t1), color='tab:blue', marker='o')
plt.plot(t2, f(t2), color='black')

plt.subplot(212)
plt.plot(t2, np.cos(2*np.pi*t2), color='tab:orange', linestyle='--')
plt.show()

반응형
Comments