表示序列覆盖范围的图

问题描述 投票:0回答:1

有没有人有想法生成一个看起来像这样的图:plot

基本上,我会有序列,例如 T1 和 T2,需要与“主”序列对齐。另外,请注意,这里不需要实际比对,序列范围是已知的(例如,T1 是 7-12、32-36)。这些区域只需相应地放置并表示即可。

我想用条形图来表示它,但由于该区域会有中断,所以没有帮助。

python plot graph representation
1个回答
0
投票

这是一个非常简约的示例,应该可以帮助您继续:

import matplotlib.pyplot as plt


Main = "123684651984656497243684986425465798"
T1 = "651984"
T2 = "864"


f, ax = plt.subplots()
ax.set_axis_off()
ax.text(.1,.5, 
        "\n".join(
            [Main, 
             " "*Main.index(T1) + T1, 
             " "*Main.index(T2) + T2]),
        ha="left", 
        va="center",
        family="monospace")

© www.soinside.com 2019 - 2024. All rights reserved.