본문 바로가기

언어 꿀Tip/Python 꿀tip!

07_01_08. seaborn x축 날짜 변경 (시계열 형태)

from matplotlib import pyplot as plt #plot

fig = plt.figure(figsize=(20,25))
p = sns.relplot("oper_date", "bg_purch_qty", data=df_plot, estimator=None, kind='line', col='goods_cd', col_wrap=5)
x_dates = df_plot['oper_date'].dt.strftime('%y-%m').sort_values().unique()
p.set_xticklabels(label=x_dates, rotation=45, ha='right')

stackoverflow.com/questions/51105648/ordering-and-formatting-dates-on-x-axis-in-seaborn-bar-plot