{그래프를 그릴 ax}.imshow({이미지 Data})
fig, axes = plt.subplots(2, 5, figsize=(20, 8))
axes = axes.flatten()
for i in range(10):
axes[i].imshow(data[i].reshape(8, 8), cmap='gray_r')
# cmap : 'gray_r'로 지정하면, 흑백으로 Image를 바꿔 데이터로 표시해줌
axes[i].set_title(target[i], fontweight='bold')
axes[i].spines['top'].set_color('red')
axes[i].spines['bottom'].set_color('red')
axes[i].spines['left'].set_color('red')
axes[i].spines['right'].set_color('red')
axes[i].set_xticks([])
axes[i].set_yticks([])
# margin 조정
fig.subplots_adjust(left=0.125,
bottom=0.1,
right=0.9,
top=0.9,
wspace=0,
hspace=0)
fig.tight_layout()
plt.show()
import matplotlib.patches as patches
로 모듈을 가지고 와야 함rect = patches.Rectangle({Rectangle 시작 위치}, {가로 길이}, {세로 길이})
# facecolor : patch 색
# edgecolor : patch 테두리 색
# alpha : patch의 투명도
ax.add_patch(rect) # 위에서 그린 Patch를 Ax에 적용함
import matplotlib.patches as patches
fig, ax = plt.subplots(1, 1, figsize=(5, 5))
ax.imshow(data[0].reshape(8, 8), cmap='gray_r')
rect = patches.Rectangle((1, 2),
3, 4,
edgecolor='r', facecolor='red', alpha=0.3)
# (1,2)에서 시작하여 가로 3, 세로 4의 Rectangle을 그림
ax.add_patch(rect)
plt.show()
colored({단어 or 문장}, {글씨 색}, {HighLight})
Highlight : 글자를 강조하는 방법을 전달하는 Paramter
IPython의 HTML을 활용할 수도 있다고는 하지만, 이는 HTML을 공부해야 활용 가능하기 때문에 일단 활용할 수 있다는 것만 알아두자
from IPython.core.display import HTML
HTML("{적용하고 싶은 HTML 문법}")