데이터를 그래픽 요소로 매핑하여 시각적으로 표현하는 것
왜 시각화 하나요?
시각화 결과는 누구를 대상으로 하나요?
어떤 데이터를 시각화 할 것 인가요?
어떤 흐름에서 인사이트를 전달할 것 인가요?
전달하고자 하는 내용에 맞는 방법인가요?
만족스러운 디자인을 가지고 있나요?
import matplotlib.pyplot as plt
fig = plt.figure()
plt.show()
fig = plt.figure()
ax = fig.add_subplot()
plt.show()
fig = plt.figure(figzise=(12,7))
ax = fig.add_subplot(121)
# ax = fig.add_subplot(1,2,1)
fig = plt.figure()
ax = fig.add_subplot()
x = [1,2,3]
# x = np.array([1,2,3])
plt.plot(x)
plt.show()
fig = plt.figure()
x1=[1,2,3]
x2=[3,2,1]
ax1 = fig.add_subplot(211)
ax2 = fig.add_subplot(212)
ax1.plot(x1)
ax2.plot(x2)
plt.show()
ax.plot([1,1,1],color='r') # 한 글자로 색상 정하기
ax.plot([2,2,2],color='forestgreen') # color name
ax.plot[3,3,3],color='#000000') # hex code
ax.plot([1,1,1],label='1')
ax.plot([2,2,2],label='2')
ax.plot[3,3,3],label='3')
ax.legend()
ax.set_title('basic')
fig.suptitle('basic') # super
fig 전체 플롯 title에 제목 추가
ax에서 특정 데이터를 변경하는 경우 .set_{} 형태의 메소드가 많음
가져올때는 ax.get_{} 으로 가져오면 됨
ax.set_xticks([0,1,2])
ax.set_xticks([0,1,2])
ax.set_xticklabels(['zero','one','two'])
ax.text(x=1 ,y=2 ,s = 'This is text')
ax.annotate(text='This is Text',xy=(1,2))