[英]How to format the y- or x-axis labels in a seaborn FacetGrid
[英]Python seaborn facetgrid x-axis dates not showing
我們如何繪制帶有日期時間值的facetgrid,如下面的第一個示例所示。
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")
嘗試更改第二部分:
從:
g.map(plt.bar, "date", "value")
至:
g.map(sns.barplot, "date", "value")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.