下表是我们已经计算好了的D0到D14共15个指标间的关联度矩阵(该表数据下载见文末附件),我们需要用该数据绘制成关联度图,即网状图。
使用工具:Asymptote和Photoshop
.asy文件需要使用Asymptote软件
.eps文件需要使用Photoshop软件
Asymptote安装好后,可以不修改路径,我们直接把要运行的代码文件test.asy放在:
计算机→系统(C:)→Users→Administrator文件夹下面。
下面是test.asy中具体代码,可直接建一个test.txt文件,然后将代码复制进去保存后,修改文件后缀.txt为.asy即可,注意第二行代码中的x中的数据即为我们上面所说的关联度数据,该代码文件下载见文末附件。
test.asy文件代码:
real[][] x={ {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0.8187,1,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0.7452,0.6233,1,0,0,0,0,0,0,0,0,0,0,0,0}, {0.5471,0.5234,0.5492,1,0,0,0,0,0,0,0,0,0,0,0}, {0.5467,0.5232,0.5488,0.9788,1,0,0,0,0,0,0,0,0,0,0}, {0.5404,0.52,0.5422,0.7209,0.7232,1,0,0,0,0,0,0,0,0,0}, {0.6665,0.5826,0.6739,0.6083,0.6108,0.603,1,0,0,0,0,0,0,0,0}, {0.7024,0.6004,0.7114,0.5744,0.5752,0.6481,0.8134,1,0,0,0,0,0,0,0}, {0.5909,0.5451,0.5949,0.8675,0.8483,0.6173,0.6721,0.6276,1,0,0,0,0,0,0}, {0.5316,0.5157,0.533,0.6685,0.67,0.7184,0.5513,0.548,0.5876,1,0,0,0,0,0}, {0.5968,0.548,0.6011,0.6412,0.6418,0.6852,0.7761,0.8255,0.7532,0.589,1,0,0,0,0}, {0.6512,0.7402,0.7262,0.5256,0.5254,0.522,0.5905,0.61,0.5494,0.5172,0.5526,1,0,0,0}, {0.5944,0.5477,0.5975,0.6408,0.6386,0.6086,0.6423,0.6163,0.7587,0.5847,0.7421,0.5508,1,0,0}, {0.6181,0.5712,0.6099,0.6601,0.6587,0.6373,0.6104,0.5909,0.7025,0.6075,0.6899,0.626,0.6972,1,0}, {0.5536,0.5412,0.5371,0.6871,0.6886,0.7171,0.5528,0.5434,0.5975,0.7254,0.5906,0.5202,0.6081,0.6225,1}, }; pair[] px={(1000,2000),(1410,1910),(1740,1670),(1950,1310),(1990,900),(1870,500),(1590,190),(1210,20),(790,20),(410,190),(130,500),(10,900),(50,1310),(260,1670),(590,1910)}; for (int i=1;i<15;++i){ for(int j=0;j<i;++j){ path temp=px[i]--px[j]; draw(temp,gray((1-x[i][j])*(1-x[i][j]))+linewidth(50*x[i][j]*x[i][j]*x[i][j])); } } dot(px);
第25行代码,设置的是关联度图中线段线条的粗细值(linewidth)和颜色的深度值(gray)。
图中任意一条线段的线条的粗细值是对应关联度值大小的立方,任意一条线段的颜色的深度值是对应关联度值大小的平方。
至此,数据、代码、软件准备好后,我们就开始来运行了。
首先,运行dos操作系统
其次,进入dos系统,输入:asy -v test.asy,按Enter键即可运行test.asy文件。
运行完毕后,我们会发现计算机→系统(C:)→Users→Administrator文件夹下面多了一个文件:test.esp,该文件即为我们所需要绘制的关联度图,可以使用Photoshop软件打开。
依次点击上图Photoshop对话框中的文件→存储为,弹出存储对话框,我们选择存储格式为图片格式(.png、.jpeg等)即可,如下图所示。
但是上面这个图没有标签,我们可以自己使用画图软件将标签添加上去,最终关联度图的效果图如下图所示。
附件:
包含关联度矩阵数据文件(test.xls)和代码文件(test.asy):
—————————————————————————
【版权申明】
如非注明,本站文章均为 数据小雄 原创,转载请注明出处:数据小雄博客,并附带本文链接,谢谢合作!
本文地址:http://zhangzhengxiong.com/?id=61。
—————————————————————————
流泪
0人
打酱油
1人
开心
17人
鼓掌
0人
恐怖
0人
发表评论
额 本文暂时没人评论 来添加一个吧