I'm trying to plot data for research. It should look like this,
This was drawn with R. I was wondering if there is any way to draw something like this in Python? Each segment has their own start and end from 2 variables that are in x
. y
is just the IDs of the samples.
Here is the R code,
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