在seaborn中使用线图时,x轴上的数据点丢失

时间:2019-08-07 10:01:51

标签: python pandas seaborn

我正在绘制一些具有日期和每个域得分的数据,因此x轴具有日期,y轴具有得分(0-10),并且每个图都针对不同的域。

我的数据有13个日期(X轴上有13个点),但是在绘制时,我只有8个日期!

我已经检查了输入线图,它具有所有13个日期。

for domain in behaviors:
    fig,ax = plt.subplots()
    ax = sns.lineplot(x = 'submitted_at', y = str(domain), data = c53_behaviorl_T.iloc[0:13,:].reset_index(), lw = 3)
    ax.set_xticklabels(c53_behaviorl_T.reset_index().submitted_at,rotation=45)
    ax.set(xlabel = 'Date', ylabel = 'Score', title = domain)

这是运行输入数据时得到的:

question submitted_at        ...         water preference
0          2018-05-08        ...                        0
1          2018-05-21        ...                        1
2          2018-05-28        ...                        0
3          2018-06-06        ...                        0
4          2018-06-26        ...                        0
5          2018-07-27        ...                        0
6          2018-07-31        ...                        0
7          2018-09-12        ...                        0
8          2018-09-26        ...                        0
9          2018-10-12        ...                        0
10         2018-10-30        ...                        0
11         2018-12-06        ...                        0
12         2018-12-15        ...                        0

[13 rows x 20 columns]

但是我的线条图停止在日期7(2018-09-12)。

0 个答案:

没有答案