728x90
ref : https://matplotlib.org/api/_as_gen/matplotlib.pyplot.subplots.html
1. 1 x 2 열 subplot
import numpy as np
import matplotlib.pyplot as plt
# First create some toy data:
x = np.linspace(0, 2*np.pi, 400)
y = np.sin(x**2)
# Create two subplots and unpack the output array immediately
f, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
ax1.plot(x, y)
ax1.set_title('Sharing Y axis')
ax2.scatter(x, y)
plt.show()
2. 2x2 서브플롯 생성
import numpy as np
import matplotlib.pyplot as plt
# First create some toy data:
x = np.linspace(0, 2*np.pi, 400)
y = np.sin(x**2)
# Create four4 axes and access them through the returned array
fig, axs = plt.subplots(2, 2)
axs[0, 0].plot(x, y)
axs[1, 1].scatter(x, y)
plt.show()
300x250
'컴퓨터과학 > 기타' 카테고리의 다른 글
파이토치과정 - 1. 도커 (0) | 2020.10.31 |
---|---|
라즈베리파이 모니터 없이 wifi 설정, ssh 접속, vnc까지 (0) | 2020.08.29 |
matplotlib - 1. 단순한 subplots (0) | 2020.08.25 |
openmp - 25. 테스크 데이터 유효범위와 피보나치 (0) | 2020.07.30 |
openmp - 24. 테스크 (0) | 2020.07.30 |