如何在matplotlib的主图中绘制箭头和矩形(用于蛋白质sec结构?)>

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

我正在尝试在matplotlib中绘制箭头和矩形(以表示蛋白质二级结构),位于图的y轴旁边,类似这样:

enter image description here

here中我得到了箭头部分,但是我不知道如何在y轴外绘制它。另外,除了箭头以外,还有没有办法绘制矩形?代码和输出如下:

import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
x_tail = 0.0
y_tail = -0.1
x_head = 0.0
y_head = 0.9
dx = x_head - x_tail
dy = y_head - y_tail
fig, axs = plt.subplots(nrows=2)
arrow = mpatches.FancyArrowPatch((x_tail, y_tail), (dx, dy),
                                 mutation_scale=50,
                                 transform=axs[0].transAxes)
axs[0].add_patch(arrow)

arrow = mpatches.FancyArrowPatch((x_tail, y_tail), (dx, dy),
                                 mutation_scale=100,
                                 transform=axs[1].transAxes)
axs[1].add_patch(arrow)
axs[1].set_xlim(0, 1)
axs[1].set_ylim(0, 1)

enter image description here

我正在尝试在matplotlib中绘制箭头和矩形(以表示蛋白质的二级结构),位于图的y轴旁边,类似这样:从这里我得到了箭头部分,但是我不能...

python matplotlib
1个回答
0
投票

看起来原始方法有点令人困惑。

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