首页 > 解决方案 > Python中的线段绘图

问题描述

我正在尝试绘制数据以进行研究。它应该看起来像这样,

分段图

这是用 R 绘制的。我想知道是否有任何方法可以在 Python 中绘制这样的东西?每个段都有自己的起点和终点,它们来自 中的 2 个变量xy只是样本的 ID。

这是R代码,

df <- read.table("df.hom",header=T,stringsAsFactors = F)

p1 <- ggplot(df[which(df$PHE == 2),])

p1 <- p1 + geom_segment(aes(x=POS1, xend=POS2, y=IID, yend=IID), size=5)

p1 <- p1 + xlab("Position (in Mb)") + ylab("Sample")

p1 <- p1 + theme_bw()

p1

标签: pythonrvisualization

解决方案


推荐阅读