我尝试使用 sns seaborn 和 stack 制作直方图,但为什么直方图之间有一些空白?
sns.histplot(data=airline_df, x="age", Hue="customer_type", multiple="stack")
这是我的代码
我尝试重新运行但不起作用
import seaborn as sns
# If you suspect the data is discrete and want to treat it as such
sns.histplot(data=airline_df, x="age", hue="customer_type", multiple="stack", discrete=True)
# If you want to manually specify bin width
sns.histplot(data=airline_df, x="age", hue="customer_type", multiple="stack", binwidth=5)
# If you want to specify custom bin edges
bin_edges = [0, 18, 30, 40, 50, 60, 70, 80, 90, 100] # Example bin edges
sns.histplot(data=airline_df, x="age", hue="customer_type", multiple="stack", bins=bin_edges)