我想把几个图绘制成FacetGrid,每个图包括两个时间点。此外,我还想计算并显示直线的坡度:
ID TimePoint1 TimePoint2
================================
A 500 20000
B 200 1000
C 3000 50000
我尝试了这个代码示例,但图中没有显示任何内容:
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
data = pd.read_table("test.csv", sep=",")
g = sns.FacetGrid(data, col="ID", col_wrap=4, height=2, ylim=(0, 10))
g.map(sns.pointplot, "TimePoint1", "TimePoint2", color=".3", ci=None)
我如何通过seaborn实现这一点
这里使用TimePoint1作为x,TimePoint2作为y。要实现您想要的,您首先需要重塑数据。假设
data
输入数据:输出:
NB。我删除了无效的ylim
数据长度:
您还可以方便地使用^{} ,它是FacetGrid的包装器:
相关问题 更多 >
编程相关推荐