- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有几个针对不同分子的不同方法的 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 值显示相同的颜色。
最佳答案
我设法解决了。我会留下答案,以防其他人发现它有用。
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')
获取
关于Python极坐标图;给定数据集的每个点使用不同的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37168789/
在下面的代码中,我得到一个 uninitialized value警告,但仅限于第二个 given/when例子。为什么是这样? #!/usr/bin/env perl use warnings; u
整个“开关”功能是否已成为实验性的?在没有 Perl 的 future 版本破坏我的代码的情况下,我可以依赖其中的某些部分吗?一般来说,将稳定功能更改为实验性的政策是什么? 背景use feature
有没有办法在一个条件语句中写出如下语句? a和b不能同时等于5。 (a可以是5,b可以是5,但是a AND b不能是5) 最佳答案 正如克里斯指出的那样,您要查找的是逻辑异或,相当于逻辑不等于 !=:
我正在寻找一种算法来找到给定 n 条线段的所有交点。以下是来自 http://jeffe.cs.illinois.edu/teaching/373/notes/x06-sweepline.pdf 的伪
数组中有 N 个元素。我可以选择第一项最多 N 次,第二项最多选择 N-1 次,依此类推。 我有 K 个 token 要使用并且需要使用它们以便我可以拥有最大数量的项目。 arr = [3, 4, 8
我正在尝试修复法语文本中的语法性别,想知道是否有办法从某个词条中获取所有单词的列表,以及是否可以在此类列表中进行查找? 最佳答案 尝试: import spacy lemma_lookup = spa
我正在为 Win32 编写一个简单的自动化测试应用程序。它作为一个单独的进程运行,并通过 Windows API 访问目标应用程序。我可以阅读窗口层次结构,查找标签和文本框,并通过发送/发布消息等来单
在 nodeJs 中使用 Sequelize 时,我从 Sequelize 收到此错误,如下所示: { [SequelizeUniqueConstraintError: Validation erro
本文https://arxiv.org/pdf/1703.10757.pdf使用回归激活映射 (RAM) - 而不是类激活映射 (CAM) 来解决问题。有几篇文章描述了如何实现 CAM。但是我找不到
我正在研究 Mach 动态链接器 dyld。这个问题适用于所有 Apple 平台,但很高兴得到特定于平台的答案;我正在使用 ObjC,但如果对你有用的话,我也很乐意翻译 Swift。 The rele
我有一个包含数千个 Instagram 用户 ID 的列表。我如何获得他们的 Instagram 用户名/句柄? 最佳答案 你必须使用这个 Instagram API: https://api.ins
我在下面的代码: def main(args: Array[String]) { val sparkConf = new SparkConf().setAppName("Spark-Hbase").s
我有一个表格,其中包含从 1 到 10 的数字。(从 D2 到 M2) 假设A1中有03/09/2019 并且在B1中有06/09/2019 并且在C1中有Hello 在A 列中,我有多个系列的单词,
我想在给定服务对应的 URI 的情况下检索服务的注释(特别是 @RolesAllowed )。这是一个例子: 服务: @GET @Path("/example") @RolesAllowed({ "B
我看到 OraclePreparedStatementexecuteQuery() 表现出序列化。也就是说,我想使用相同的连接对 Oracle 数据库同时运行两个查询。然而,OraclePrepare
import java.util.Scanner; public class GeometricSumFromK { public static int geometricSum(int k,
我创建了一个抽象基类Page,它说明了如何构建动态网页。我正在尝试想出一种基于作为 HttpServletRequest 传入的 GET 请求生成 Page 的好方法。例如... public cla
我的字符串是一条短信,采用以下两种格式之一: 潜在客户短信: 您已收到 1 条线索 标题:我的领导 潜在客户 ID:12345-2365 警报设置 ID:890 短信回复: 您已收到 1 条回复 标题
我在 python 中有以下代码: class CreateMap: def changeme(listOne, lisrTwo, listThree, listFour, listfive):
这是在 Hibernate 上运行的 JPA2。 我想检索相同实体类型的多个实例,给定它们的 ID。其中许多已经在持久性上下文和/或二级缓存中。 我尝试了几种方法,但似乎都有其缺点: 当我使用 ent
我是一名优秀的程序员,十分优秀!