用不同时间序列的Seaborn tsplot作图

2024-06-26 13:23:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图用tsplot来可视化Gillespie算法,但是由于每个复制和处理的时间点集是不同的,所以这些点并不相连。有什么办法解决这个问题吗?下面是gammas示例的代码,其中我更改了一个时间点:

import numpy as np; np.random.seed(22)
import seaborn as sns; sns.set(color_codes=True)
gammas = sns.load_dataset("gammas")
print(gammas)
print(gammas.iloc[3000,0])
print(gammas.iloc[3060,0])
gammas.iloc[3000,0]=5.050505050515
ax = sns.tsplot(time="timepoint", value="BOLD signal",unit="subject", condition="ROI",data=gammas,err_style='unit_traces')

Tags: import算法可视化asnp时间unitprint
1条回答
网友
1楼 · 发布于 2024-06-26 13:23:19

差距的产生是因为当在某些时间点出现“缺失”的观察值时,您的数据中会出现nans。尝试:

sns.tsplot(..., estimator=np.nanmean)

你的例子给了我一条实实在在的线索。在

相关问题 更多 >