본문 바로가기

언어 꿀Tip/Python 꿀tip!

07_01_21.matplotlib , 여러 plot 그릴 때 모든 plot x축 고정 : sharex =True

# [matplotlib , 여러 plot 그릴 때 모든 plot x축 고정 : sharex =True]
fib, axs = plt.subplots( 4, 5, figsize=( 40, 20) , sharex =True)
axx = axs.ravel() 

for i, v_biz_goods in enumerate(l_biz_goods_sub):
    #         print(i, v_biz_goods, l_biz_goods_nm[i])
            df_sub_01[ df_sub_01["bizpl_goods_cd"] == v_biz_goods].sort_values("week_yr").plot.line(x='week_yr', y=['bg_purch_qty','week_stk_qtg',"in_qty"], ax=axx[i])
            axx[i].axhline( y= df_min_stk[ df_min_stk["bizpl_goods_cd"] ==  v_biz_goods].ord_stand_qty.tolist() , color='r', linestyle ='-')  # x축에 평행한 선 그리기
            axx[i].set_title(l_biz_goods_nm_sub[i] ,fontproperties=fontprop)