matplotlib 라이브러리 정리(2)
레이블 추가하기 ✍️
plt.plot([1, 2, 3, 4], [2, 3, 5, 10])
plt.xlabel('X-Axis', labelpad=15)
plt.ylabel('Y-Axis', labelpad=20)
plt.show()

범례 추가하기 ✍️
plt.plot([1, 2, 3, 4], [2, 3, 5, 10], label='Price ($)')
plt.xlabel('X-Axis')
plt.ylabel('Y-Axis')
plt.legend(loc='lower right')
plt.show()

막대그래프 응용 ✍️
figure = plt.figure()
axes = figure.add_subplot(111)
x = [1,2,3,4]
y = [2,4,6,8]
x2 = [1,2,3,5]
y2 = [4,4,3,6]
axes.bar(x,y)
axes.bar(x2,y2)
plt.show()

막대그래프 응용(2) ✍️
figure = plt.figure()
axes = figure.add_subplot(111)
axes2 = axes.twinx()
x = [1,2,3,4]
y = [2,4,6,8]
x2 = [1,2,3,4]
y2 = [4,6,1,9]
axes.bar(x,y,color='green',label='bar')
axes2.plot(x2,y2,color='r',label='plot')
axes.legend()
axes2.legend(loc=1)
plt.show()

원 그래프 그리기 ✍️
figure = plt.figure()
axes = figure.add_subplot(111)
label = ['a','b','c','d']
data = [1,1,2,3]
axes.pie(data,labels=label)
plt.show()
