我想创建一个关联矩阵.
我有一个包含3列的文件,例如:
id x y
A 22 2
B 4 21
C 21 360
D 26 2
E 22 58
F 2 347
Run Code Online (Sandbox Code Playgroud)
我想要一个矩阵(没有col和row名称):
2 4 21 22 26 58 347 360
A 1 0 0 1 0 0 0 0
B 0 1 1 0 0 0 0 0
C 0 0 1 0 0 0 0 1
D 1 0 0 0 1 0 0 0
E 0 0 0 1 0 1 0 0
F 1 0 …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 Julia 中绘制散点图,我在那里有 3 个课程。
我想为每个类定义不同的颜色。
我试过:
using(PyPlot)
pca = readdlm("pca1_2_fam.txt", header=false);
plot(pca[:,3], pca[:,4], color = pca[:,1])
Run Code Online (Sandbox Code Playgroud)
pca 文件如下:
名称1 208094 -0.00476681 0.00822032
名称1 514876 -0.00531507 -0.00721858
名称2 515043 0.00365503 -0.01794700 名称2
515066 0.00467896 0.00420396名称3
799073 0.00811660 -0.01903420 名称3 GLTGH40
0.00380041 0.00618471
在 R 中,我只是使用以下方法做到了这一点:
colnames(pca)=c("Breed","Animal","PCA1","PCA2")
qplot(PCA1,PCA2,data=pca,color=Breed,geom=c("point")) + theme(legend.position="none")
Run Code Online (Sandbox Code Playgroud)
我想学习如何在 Julia 中做到这一点。