我试图在这个link中获得如图A所示的数字。我唯一不能成功的是链接中图A顶部的图标。我不知道如何获得这些图标(alpha螺旋,beta表和线圈)。我使用的输入文件是here。输入文件的第一列(图的x轴)是残差号。图标代表残留物。例如,残基1-25,残基26-45,残基46-60和残基61-80分别代表α螺旋,β折叠,线圈和α螺旋......我的代码给出了下图。正如我所说,我还需要在图的顶部添加蛋白质二级结构图标。我怎么能这样做?
我的代码:
#!/usr/bin/python
import numpy as np
import pylab as plot
import matplotlib.pyplot as plt
import numpy, scipy, pylab, random
from matplotlib.ticker import MultipleLocator
import matplotlib as mpl
from matplotlib.ticker import MaxNLocator
with open("rmsf.xvg", "r") as f:
x=[]
y1=[]
y2=[]
y3=[]
for line in f:
if not line.strip() or line.startswith('@') or line.startswith('#'): continue
row = line.split()
x.append(float(row[0]))
y1.append(float(row[1]))
y2.append(float(row[2]))
y3.append(float(row[3]))
fig = plt.figure(figsize=(3.2,2.2), dpi=300)
ax = plt.subplot(111)
plt.xlim(0, 210)
plt.ylim(0, 0.7)
ax.xaxis.set_major_locator(MaxNLocator(10))
ax.yaxis.set_major_locator(MaxNLocator(7))
ax.xaxis.set_minor_locator(MultipleLocator(5))
ax.yaxis.set_minor_locator(MultipleLocator(0.02))
plt.plot(x, y1, 'k', label='A', linewidth=0.5)
plt.plot(x, y2, 'b', label='B', linewidth=0.5)
plt.plot(x, y3, 'g', label='C', linewidth=0.5)
plt.legend( loc='upper left', fancybox=True, framealpha=0, borderaxespad=0., prop={'size':7})
plt.xlabel('# residue', fontsize=10)
plt.ylabel('RMSF (nm)', fontsize=10)
for axis in ['top','bottom','left','right']:
ax.spines[axis].set_linewidth(0.5)
plt.subplots_adjust(bottom=0.18)
plt.subplots_adjust(left=0.14)
plt.subplots_adjust(right=0.96)
plt.tick_params(axis='both', which='major', labelsize=8)
plt.tick_params(axis='both', which='minor', labelsize=0)
plt.savefig("rmsf.png", dpi=300)
输出: