2. 축
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams['font.family'] = 'Malgun Gothic' # 글자 폰트
matplotlib.rcParams['font.size'] = 15 # 글자 크기
matplotlib.rcParams['axes.unicode_minus'] = False # 한글 폰트 사용 시, 마이너스 글자가 깨지는 현상을 해결
x = [1, 2, 3]
y = [2, 4, 8]
plt.plot(x,y)
plt.title('꺾은선 그래프', fontdict={'family':'HYGungSo-Bold', 'size':20}) # 개별 폰트 설정
Text(0.5, 1.0, '꺾은선 그래프')

plt.plot(x,y)
plt.xlabel('X축', color='red', loc='right') # loc: left, right, center
plt.ylabel('Y축', color='#00aa00', loc='top') # top, center, bottom
Text(0, 1, 'Y축')

plt.plot(x,y)
plt.xticks([1, 2, 3])
plt.yticks([3, 6, 9, 12])
plt.show()

댓글남기기