对于不同的分子,我有几个RMSD值(测量两个分子结构的不同)。我想把它们画在一个极坐标图上,这样每条径向线就代表了一个分子,所有不同的RMSD值都被标绘出来了。 问题是我希望每个方法对不同的分子显示相同的颜色。到目前为止我得到了这个
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.pyplot import cm
pi = np.pi
N=11
list = np.zeros(N)
list += pi
color=iter(cm.rainbow(np.linspace(0,1,N)))
functionals = ['PBE', 'PBE-D3', 'PBE0', 'PBE0-D3', 'TPSS', 'TPSS-D3', 'TPSSh', 'B3LYP', 'B3LYP-D3', 'LCwPBE', 'LCwPBE-D3']
comp1 = list
comp2 = list/2
RMSD_comp1 = np.random.rand(N)
RMSD_comp2 = np.random.rand(N)
ax = plt.subplot(111, projection='polar')
for i in range(len(functionals)):
c=next(color)
for func in range(len(functionals)):
ax.scatter(comp1, RMSD_comp1, c=c)
ax.scatter(comp2, RMSD_comp2, c=c)
ax.set_alpha(0.75)
plt.show()
但我得到的是: 理想的情况是,当引用同一方法时,不同径向线中的每个RMSD值显示相同的颜色。在
我设法解决了。我留下答案以防万一别人觉得有用。在
得到
相关问题 更多 >
编程相关推荐