相关疑难解决方法(0)

带有seaborn tsplot的多线图

我想用matplotlib和seaborn创建一个平滑的折线图.

这是我的数据帧df:

hour    direction    hourly_avg_count
0       1            20
1       1            22
2       1            21
3       1            21
..      ...          ...
24      1            15
0       2            24
1       2            28
...     ...          ...
Run Code Online (Sandbox Code Playgroud)

折线图应包含两行,一行direction等于1,另一行direction等于2.X轴为hourY轴,Y轴为hourly_avg_count.

我试过这个,但我看不到线条.

import pandas as pd
import seaborn as sns
import matplotlib
import matplotlib.pyplot as plt

plt.figure(figsize=(12,8))
sns.tsplot(df, time='hour', condition='direction', value='hourly_avg_count')
Run Code Online (Sandbox Code Playgroud)

python matplotlib seaborn

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

标签 统计

matplotlib ×1

python ×1

seaborn ×1