小编ZKI*_*ING的帖子

如何向每个面添加水平平均线和注释

我有一个 2 行 1 列的简单 FacetGrid,其中的线图表示构面的不同类别 - 如下图。

# lineplot for each Category over the last three years
g = sns.FacetGrid(df, row="Category", sharey=False, sharex=False, height=2.5, aspect = 3)
g = g.map(plt.plot, 'Date', 'Count')
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

如何添加显示每个方面的平均计数的参考线和注释?

样本数据

  • 读取示例数据框
# lineplot for each Category over the last three years
g = sns.FacetGrid(df, row="Category", sharey=False, sharex=False, height=2.5, aspect = 3)
g = g.map(plt.plot, 'Date', 'Count')
Run Code Online (Sandbox Code Playgroud)

df.head()

import pandas as pd

data = {'Category': ['Group 1', 'Group 1', 'Group 1', 'Group 1', 'Group 1', 'Group …
Run Code Online (Sandbox Code Playgroud)

python matplotlib pandas seaborn facet-grid

2
推荐指数
1
解决办法
3489
查看次数

标签 统计

facet-grid ×1

matplotlib ×1

pandas ×1

python ×1

seaborn ×1