2016-05-11 5 views
1

私は、異なる分子の異なる方法についていくつかのRMSD値(2つの分子構造がどのように異なるかの測定値)を持っています。私はそれらを極座標チャートにプロットしたいので、各ラジアルラインはすべての異なるRMSD値がプロットされている分子を表します。 問題は、各メソッドが異なる分子に対して同じ色を表示したいということです。これまでのところ私はこのPythonポーラーチャート;与えられたデータセットの各点について異なる色

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() 

を得たが、イムは、この取得: Chart plot 理想的なことは、同じ方法を参照するときに同じ色を示す異なる半径ラインの各RMSD値を持っているだろう。

答えて

1

私はそれを整理することができました。誰かがそれが有用であると判断した場合に備えて、回答を残してください。

import numpy as np 
import matplotlib.pyplot as plt 
from pylab import * 

colors = [ 'r', 'r', 'g', 'g', 'b','b', 'orange', 'y', 'y', 'm', 'm'] 

m = ['o', 'v', '<', '>', 's', '*', '^', 'x', 'p', 'h', '8'] 

functionals = ['PBE', 'PBE-D3', 'PBE0', 'PBE0-D3', 'TPSS', 'TPSS-D3', 
      'TPSSh', 'B3LYP', 'B3LYP-D3', 'LCwPBE', 'LCwPBE-D3'] 

list_compounds = ['1', '2', '3', 
       '4', '8', '9', '10', '12', '13', 
       '6', 
       '5', '7', '11', '14', '16a', '16b', 
       '17', '18' ] # U(III), U(IV), U(V), U(VI) and dimers 

''' This section divides the chart in equidistant parts and defines the RMSD values calculated for each compound with the != functionals ''' 

N= 5 #number of compounds 
mult = 360./N 
angles = np.arange(N)*mult 

''' The three lists correspond to the results coming from Gaussian09_d, NWChem16 and ADF_2016 respectively ''' 

#            *** U(III) *** 

RMSD_comp1 = [ [ 0.2116, 0.2914, 10, 10, 0.1959, 0.3102, 0.2301, 0.1691, 0.3176, 10, 10 ], [ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 ], 
      [ 0.2217, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 ] ] #Gaussian/NW/ADF 

RMSD_comp2 = [ [ 0.4400, 10, 0.3817, 10, 1.334, 10, 0.8540, 10, 10, 0.5016, 10 ], [ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 ], [ 0.3907, 0.3503, 10, 10, 10, 10, 10, 10, 10, 10, 10 ] ] 

RMSD_comp3 = [ [ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 ], 
      [ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 ], 
      [ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 ] ] 

#            *** U(IV) *** 

RMSD_comp4 = [ [ 0.3072, 0.1692, 0.3212, 0.1748, 0.3985, 0.1584, 0.2595, 0.3111, 0.1382, 0.1956, 0.1378 ], 
      [ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 ], 
      [ 0.2000, 0.1443, 10, 10, 10, 10, 10, 10, 10, 10, 10 ] ] 

RMSD_comp8 = [ [ 0.7000, 0.6039, 0.5817, 0.5000, 0.7124, 0.5223, 1.2091, 0.6423, 0.4859, 1.0559, 0.7471 ], 
      [ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 ], 
      [ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 ] ] 

RMSD_comp9 = [ [ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 ], 
      [ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 ], 
      [ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 ] ] 


compounds = np.vstack((RMSD_comp1, RMSD_comp2, RMSD_comp3, RMSD_comp4, RMSD_comp8, RMSD_comp9)) 


#          *** Plot of GAUSSIAN_09-d results *** 

fig = plt.figure(figsize=(10,12)) 
ax = plt.subplot(111, projection='polar') 
plt.title('RMDS Gaussian', fontsize=18, x=0.51, y=1.07) 

angle=0 
for comp in range(0, 3*N, 3): 
    for func in range(len(functionals)): 
      ax.scatter([np.radians(angles[angle])], compounds[comp][func], c=colors[func], s=75, marker=m[func], label=functionals[func] if comp == 0 else "") 
    angle+=1 

    ax.set_alpha(0.75) 


legend = ax.legend(bbox_to_anchor=(0.10, -0.32, 0.85, 0.25), borderaxespad=0, mode="expand", fontsize='small', scatterpoints=1, ncol=6, frameon=False) 
ax.set_thetagrids(angles, labels=list_compounds, fontsize=12, rotation=0, weight='bold', color="black") 
ax.set_rgrids([0.2, 0.4, 0.6, 0.8, 1.0, 1.2], angle=15.) 
ax.set_rmax(1.4) 
fig.tight_layout() 

plt.close('all') 

取得

enter image description here

関連する問題