본문 바로가기

언어 꿀Tip/Python 꿀tip!

07_01_39. matplotlib 그래프 이중축 graph 생성 및 축이름


import pandas as pd
from matplotlib import pyplot as plt

fig, ax0 = plt.subplots()
ax1 = ax0.twinx()

ax0.plot( df_tot['part_datecd'], df_tot['ntsal_amt_m'], color='black')
ax1.plot( df_tot['part_datecd'], df_tot['ntsal_amt_ff_m'] , color='blue')

ax0.set_xlabel('date')
ax0.set_ylabel('amt')
ax1.set_ylabel('amt(1')