0
我們如何繪製具有日期時間值的facetgrid,如下面的第一個示例所示。Python seaborn facetgrid x軸日期不顯示
from datetime import date, timedelta
import pandas as pd
import seaboarn as sns
test = [{"date": date.today(), "categ": "test1", "value": 100}, {"date": date.today() - timedelta(days=1), "categ": "test2", "value": 200}]
df = pd.DataFrame(test)
第一示例使用seaborn
ax= sns.barplot("date","value", data=df)
其次使用FacetGrid
g = sns.FacetGrid(df, row='categ')
g.map(plt.bar, "date", "value")
Example2實施例