-
Notifications
You must be signed in to change notification settings - Fork 0
/
pca.js
executable file
·61 lines (59 loc) · 12.9 KB
/
pca.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// You can reproduce this figure in node.js with the following code!
// Learn about API authentication here: https://plot.ly/nodejs/getting-started
// Find your api_key here: https://plot.ly/settings/api
var plotly = require('plotly')('username', 'api_key');
trace1 = {
mode: 'markers',
name: 'f',
type: 'scatter3d',
xsrc: 'DanO5113:1:1b361e',
x: [-0.393684656547604, -0.373116872918386, -0.615963036242311, -0.513777846415425, -0.330348163276931, -0.499119147237566, -0.322496382127601, -0.531995004258769, -0.351490455629075, -0.355686134114334, -0.249292852350295, -0.110794321679376, -0.513762380786638, -0.187908527633067, -0.218109252125327, -0.403165614840949, -0.580819176959682, -0.192413172920991, -0.195670909916301, -0.192941347665343, -0.279026709810182, -0.401825270896648, -0.20975870056003, -0.154426181395389, -0.129729787296561, -0.0576666963008394, -0.407605333607029, -0.296982265954133, -0.594848921569959, -0.296378910039182, -0.200680521071093, -0.201303433927065, -0.28991620676027, -0.330306403758757, -0.113890641301843, -0.233748155069686, -0.654001958200129, -0.550535091563404, -0.618434853430693, -0.486552879100011, -0.545454471580921, -0.489040731197122, -0.641543033387364, -0.519817617821939, -0.421978846631172, -0.437929583009621, -0.442834700543203, -0.365286304447395, -0.587881927228907, -0.559474513116759, -0.453893400778899, -0.307510647265048, -0.505643829324512, -0.202009172545552, -0.476434866818439, -0.711561036330776, -0.461688494365416, -0.488965638647779, -0.262364892340779, -0.411148956454219, -0.341062410924625, -0.396488942788852, -0.0781099692946085, -0.187607212362124, -0.257640637277973, -0.260468413760261, -0.333708065221594, -0.368089753860137, 0.0831333432546864, 0.0238897226251168, -0.0930459261546283, -0.301075742699673, -0.120194737843012, -0.0108123166668793, 0.0486311862475131, -0.51397472515831, -0.185721458404709, -0.299449311723192, -0.310808212496805, -0.428226372683774, -0.261908449875233, -0.440163319997672, -0.518180079465093, -0.392624577711795, -0.156863152329447, -0.402990257620627, -0.116739895788008, -0.0962446139116072, -0.122822293956427, -0.576852744876015, -0.327741758577804, -0.448450401728518, -0.375248602867227, -0.221342336804866, -0.137193820911802, -0.317404315682159, -0.459700499818828, -0.522355196084498, -0.71966335230546, -0.45571576598135],
ysrc: 'DanO5113:1:1d097d',
y: [0.284083117774128, 0.238414818331366, 0.126213333878819, 0.330866961163844, -0.0696558260602338, -0.106220151859586, 0.148009078049245, 0.0466655686916032, 0.017071188076769, -0.189067822323158, 0.7595754892045, 0.0603089582096699, 0.155850738288916, 0.211373776214826, 0.0839319824267797, 0.11342448865845, 0.352739039079329, -0.0183210640821349, 0.293457179486982, 0.178861120313172, 0.066770277240374, 0.0637387069441601, 0.119418269899298, -0.0123875782087324, 0.144959677565498, -0.0968925582521208, 0.329113586500696, 0.32182982821686, -0.219369108855235, 0.148646525372187, 0.0391439987782091, 0.113994778670278, 0.311677468656761, 0.347001309322801, 0.173000155034097, -0.233950440414223, 0.165970030665862, 0.0615204731710177, 0.00880864408021151, 0.292971597597357, 0.0323253598219175, 0.161534469006043, 0.527872804974077, 0.111702838844734, 0.320473311387114, 0.367290781826491, -0.0426560245625742, 0.123368584860167, 0.502748523986454, -0.233713143374255, 0.57088309138619, 0.373856481651258, 0.715115888286459, -0.0936489289632016, 0.571234183672782, 0.891854615841143, -0.10761551505274, 0.181264121408007, -0.0998913083383716, -0.29245272554074, 0.0913246614419615, 0.213464897321203, -0.126710449575808, -0.141215814426287, -0.189973474612685, -0.341412019578227, -0.150321362820502, -0.254918354769705, -0.225802288398824, 0.468429979291624, 0.256010714189733, 0.554719663416432, 0.310983774623824, 0.210551001636049, 0.659211920593346, -0.541224072583991, -0.30153274989914, -0.37467721300714, -0.0946975556939141, -0.429337663986803, -0.10528206186502, -0.469814392475666, -0.236721647334003, -0.323168272484393, -0.265678947059377, -0.3761561996993, -0.357970990893061, -0.37368178844952, -0.330345484389298, 0.225304059154493, 0.0875711515401989, -0.105730030189902, -0.0705433063279757, -0.507070059566369, -0.300645637478399, -0.549899883069416, -0.440186264961441, -0.507897889369204, -0.653925452383985, -0.423030450941342],
zsrc: 'DanO5113:1:d5b710',
z: [0.12257012710191, 0.0269786948078114, 0.191959500893141, 0.0394132911003938, 0.162275602462046, 0.0964762550721304, 0.0530471300578687, 0.0398756946256233, 0.0135729038134598, 0.127094686960506, 0.263920988390136, 0.229700944424538, 0.0290879447830371, 0.117922158210281, 0.156566099498917, 0.164950286322165, 0.0748278417971049, 0.107559346628751, 0.0892374507169653, 0.0223100277549156, 0.13889885027303, 0.171122868161327, -0.179877981564369, 0.0936954186417013, 0.0451780553889787, 0.0486651512861774, 0.150191479275104, -0.0524742236176838, -0.230814457025186, -0.0876993382501796, 0.0110823416464426, 0.153604336978944, 0.123124981011905, 0.150400954367806, 0.271740863051982, 0.0475031351294934, -0.0422539300401293, 0.126044247925049, 0.0621526752826074, -0.0197344581153055, 0.181051547812136, -0.170293748535991, -0.192715517142436, -0.0370299981054508, -0.100620169240324, -0.076608091159284, -0.017272278415254, -0.2283313719867, 0.00541568683608219, -0.0535923464809611, -0.360449632992761, -0.234442750706156, -0.183861475123305, 0.104760539531211, 0.0829477846856723, -0.0227104351142894, 0.124359543288564, -0.0236248735367242, -0.0908587286308298, 0.113753543056978, -0.0280627917133042, 0.139261659639651, 0.123548187279839, 0.204726981122585, 0.0286032484218499, -0.239024917347698, -0.326802613350823, -0.0709730099541743, 0.0910927296312859, -0.337645726204614, 0.0517411698058431, 0.0677854995226544, 0.124601928002826, -0.0446194400482438, -0.0707443773507391, 0.122361174597564, 0.104739713451939, -0.0429818991352025, 0.0317479477313419, -0.0581658822912496, 0.128426656368196, -0.0292737437634025, 0.0626445628035215, 0.184809554276286, -0.0674193565526661, 0.00574245090492963, 0.0705237458336622, 0.0368818136575347, 0.0434328938019134, 0.0146127250238903, 0.0096781729618082, -0.239823267480831, -0.513063402198859, -0.162904690266151, -0.138285579732869, -0.327788685975612, -0.212682258940014, -0.0600871061726523, -0.218196299978252, -0.211176898855382],
frame: null,
marker: {
line: {color: 'transparent'},
color: 'rgba(102,194,165,1)',
fillcolor: 'rgba(102,194,165,0.5)'
}
};
trace2 = {
mode: 'markers',
name: 'm',
type: 'scatter3d',
xsrc: 'DanO5113:1:5e4643',
x: [0.134569007823807, 0.224988542194517, 0.352359539841731, 0.359085347447492, 0.42942030324964, 0.196851112400019, 0.437015710213574, 0.335290024556293, 0.428613042568451, 0.37050576049341, 0.395869777419903, 0.359983354850689, 0.434046263241746, 0.35672643437513, 0.203215216627931, 0.216833220022322, 0.554733835197534, 0.319242474843049, 0.421345190902971, 0.484906222150598, -0.0963695342016342, 0.729539750960642, 0.404228776285485, 0.469049305097844, 0.428741834417815, 0.397327561730229, 0.479659217920389, 0.290281689673371, 0.533064038766996, 0.279210147090075, 0.492349001844792, 0.365095411503543, 0.612750554009238, 0.380225194983754, 0.276760773672875, 0.302825895049371, 0.114145911478709, 0.188418237199589, 0.206592810538605, 0.108959664977209, -0.0366494255159571, 0.0704807062058019, 0.18900960222969, 0.297669363966169, 0.427891548247485, 0.543355635312881, 0.299701375102829, 0.141214619974735, 0.155756545806593, 0.227242413706144, 0.185757181263728, 0.122501754538883, -0.154987043149483, 0.316977467088615, -0.0261399416398341, 0.238451656653401, 0.197658672424944, 0.321802058781616, 0.357834000299733, 0.953080122491604, 0.486464271629177, 0.401191020243004, 0.813225283965056, 0.42321769327973, 0.309363764597677, 0.828035666865451, 0.100292173563154, 0.288469806640519, 0.228083432677922, 0.071455374229327, 0.301715996060711, 0.106134722179385, 0.266665433686816, 0.527030011037463, 0.266840108796822, 0.561031657683951, 0.652971719104584, 0.457257413585807, 0.456462241073629, 0.308855833460763, 0.553611178388089, 0.145025510513684, 0.351742844609676, 0.150053174998345, 0.275378565752865, 0.434191404581261, 0.437650606604743, 0.15239315415285, 0.52495109625953, 0.202267146755463, 0.398197972016491, 0.479412506979287, 0.20686258643334, 0.388145854083663, 0.548394391897522, 0.607119951749978, 0.217070713763158, 0.402058699183154, 0.484463083430022, 0.164277183403516, 0.21904894954553, 0.329527097910584],
ysrc: 'DanO5113:1:b07c81',
y: [-0.294640375949394, -0.16016385167358, -0.229289215239005, -0.0424403349508265, -0.114141329433387, -0.0976337523093648, -0.085192424752681, 0.0323324310537959, -0.058365843106973, 0.162693449230793, -0.189289185112315, -0.0967634407976254, 0.104421742647458, 0.0325793023170901, 0.0981148888491745, -0.00577888653594445, 0.00473620194236961, 0.139767409447184, 0.0248187177421713, 0.0157054823970751, -0.386432427425016, 0.0465971741361751, 0.0936523500168956, -0.0291875204333674, 0.192709771699978, 0.111550523797073, -0.0262215355417431, 0.179388669091187, -0.0205963357393122, -0.167522222612914, 0.0278079207721872, 0.00916487926309309, 0.479509107145069, 0.125474291172435, 0.284769067659758, -0.147231021882665, 0.128659669163359, -0.147410914826014, -0.0466574896586026, -0.236059892615195, -0.403933794612273, -0.319461334890739, -0.293253365898938, -0.171285159311389, 0.380524250067167, 0.232779831955981, -0.203231606429241, -0.3592036443006, -0.306030197657792, -0.269102603815974, -0.316752037127882, -0.412742688361095, -0.430611080885127, -0.229223849637279, -0.448145906684811, -0.306439961266783, -0.328803339461504, -0.186130633110256, -0.0854958499020275, 0.328719694640117, -0.197874862247096, 0.620469129147202, 0.649312948952364, -0.203952429497785, -0.0304350106232276, -0.220101383362951, -0.30881816493561, -0.303049624496266, -0.354993915625284, -0.328046373971427, -0.260395030830425, -0.280328620117433, -0.243007104352805, -0.188464190758462, -0.364909146379265, 0.0789959491485552, 0.139760549467656, 0.705302057037714, 0.547128273519722, -0.105005943232739, -0.18822062902829, 0.452005317914656, 0.0328476404089214, 0.406926151832656, 0.319064102711226, 0.040426847331974, 0.195398876353847, -0.139768756394139, 0.118589677007751, 0.194554319363714, -0.014146572389447, 0.380707430122387, -0.222276538011113, 0.155435102919233, 0.193311592469634, 0.258996010940369, -0.064614231270781, 0.213479990314784, -0.0861295398898622, -0.151084285538518, -0.0170698077643013, -0.268726650052846],
zsrc: 'DanO5113:1:be9ffc',
z: [0.123358965571148, -0.0843720642221073, 0.195239907411379, 0.206144573654735, 0.0788212514205906, 0.155105249963737, -0.239602363064752, -0.0332745558222029, 0.303714509455107, -0.0340078653436819, -0.323929785849091, 0.017958632414121, -0.178404994904257, -0.112947355049272, 0.108314878440366, 0.00537714189995741, 0.0295076875646611, -0.239444377986394, -0.0129804759541784, 0.0293002553674539, -0.197429940669518, -0.299920229956372, 0.128315353074795, 0.174639046143551, -0.102402836787368, 0.282211765605299, 0.174137893177038, 0.026794354941932, 0.278478282159076, 0.0603053272262297, 0.0484646750037739, 0.134734573805333, 0.449072781909339, 0.32281145318796, 0.18795340650469, 0.210978093343046, 0.188081556382498, 0.171665652465567, 0.298380462768131, 0.385514627795823, -0.176670798678248, 0.226795175216061, 0.180138404227677, 0.28686159612332, 0.233219497332286, -0.0339004542638545, 0.193958138666087, 0.124360830466689, -0.00690369024414661, 0.106634796105313, 0.0329102900565423, -0.0339622593292672, 0.0556170800838354, 0.0801892480849548, -0.319743650907429, -0.0108974315089204, 0.0290736828154538, 0.0812788437644119, 0.140919957529936, 0.0228689028795146, 0.25238079179999, -0.509338955274171, 0.187095007285407, -0.526192128797586, -0.126430769596464, 0.0228593958852704, 0.119698173634453, -0.0735596416753352, 0.177066456394676, -0.0639717193620278, -0.405594746205058, 0.130558046698235, 0.0680358489141198, -0.622884847577664, -0.472118208498019, 0.30937639483748, -0.299474741117379, -0.175551887861256, -0.49920488804385, -0.090932640438299, 0.0314253081279662, -0.113794955208651, -0.664419351724214, 0.24444283731549, -0.0761208208154143, -0.32411648697589, -0.183046786207875, -0.00697014987234437, 0.0333029352952878, 0.0143828839523268, 0.214161983559448, -0.0123082356928155, 0.185032962608456, -0.258665658761488, -0.409969340789637, -0.13913981542803, 0.0330103611503751, 0.0371256163945286, 0.193492743684531, -0.132448435394259, -0.664567705705922, 0.2909454572213],
frame: null,
marker: {
line: {color: 'transparent'},
color: 'rgba(141,160,203,1)',
fillcolor: 'rgba(141,160,203,0.5)'
}
};
data = [trace1, trace2];
layout = {
scene: {
xaxis: {title: 'PC1'},
yaxis: {title: 'PC2'},
zaxis: {title: 'PC3'}
},
xaxis: {domain: [0, 1]},
yaxis: {domain: [0, 1]},
margin: {
b: 40,
l: 60,
r: 10,
t: 25
},
hovermode: 'closest',
showlegend: true
};
plotly.plot(data, {layout: layout}, function(err, msg) {
console.log(msg);
});