Add Data & Update makeGraph
This commit is contained in:
parent
68ddddff94
commit
59b4c61aaa
30002
data/FSPB1_truth_IMU_M1.txt
Normal file
30002
data/FSPB1_truth_IMU_M1.txt
Normal file
File diff suppressed because it is too large
Load Diff
27
data/GPS_0.5_Hz_IMU_M2.txt
Normal file
27
data/GPS_0.5_Hz_IMU_M2.txt
Normal file
@ -0,0 +1,27 @@
|
||||
TIME,GPS_N,GPS_E,GPS_D
|
||||
0,10.3708625067882,10.0952218550768,-50.3636059472515
|
||||
2,10.241111580909,9.9432793303632,-49.4383526335613
|
||||
4,10.5239638960762,10.1188414480652,-50.0018201334551
|
||||
6,10.0279955572429,9.72822726331186,-50.1230816747059
|
||||
8,10.0232188037116,9.90349441915675,-49.9784141156207
|
||||
10,10.2639381666889,9.88747239490241,-50.0070067990141
|
||||
12,9.99745586881184,13.7635154140053,-49.9233412301416
|
||||
14,9.87002996476847,18.5139504079692,-49.8869446317615
|
||||
16,10.2258420586509,20.0936958425382,-49.9097345746878
|
||||
18,10.2258780712502,20.0379768005726,-50.0731297239119
|
||||
20,9.93829746667001,20.2953659613438,-50.0305411330427
|
||||
22,10.181068002134,20.1751350531825,-53.8704115247947
|
||||
24,10.1568512726943,19.8466389360939,-58.6034205876269
|
||||
26,10.0486017729737,20.1854792352038,-63.2669795094928
|
||||
28,10.4632322200149,20.1707632899614,-68.1316446446584
|
||||
30,10.1540760443197,20.0931006076,-73.0801027829146
|
||||
32,12.0444626536254,14.7080250199665,-77.6780614738264
|
||||
34,19.4685112149411,-0.486549831414522,-81.6276558670118
|
||||
36,26.8468552875275,-14.1086580045417,-87.2143098816866
|
||||
38,29.212874464773,-19.360171939344,-91.2908882122017
|
||||
40,30.0000411514542,-19.6695644007578,-96.4433657625312
|
||||
42,30.0481277091314,-20.4166025337268,-99.8414968993031
|
||||
44,29.7138852909153,-20.092187981008,-100.229123388023
|
||||
46,29.9917313945496,-19.6961176318969,-100.282018110711
|
||||
48,30.4681681976875,-19.9829861434334,-100.121888068146
|
||||
50,30.1522904034998,-19.6721608570132,-100.16760643281
|
252
data/GPS_5_Hz_IMU_M2.txt
Normal file
252
data/GPS_5_Hz_IMU_M2.txt
Normal file
@ -0,0 +1,252 @@
|
||||
TIME,GPS_N,GPS_E,GPS_D
|
||||
0,9.93404025619263,9.88665007948575,-50.4057247163188
|
||||
0.2,10.1637339687767,10.0538346792325,-49.5476114699243
|
||||
0.4,9.52798505899911,10.3626407924382,-49.9290035447891
|
||||
0.6,10.052543441311,9.8670752557234,-49.6894014613711
|
||||
0.8,10.0937916555232,9.8606884862845,-49.1484710199434
|
||||
1,10.3593924439369,10.030393041087,-49.2966288472763
|
||||
1.2,9.8679109009012,9.99230412044471,-49.6674691667464
|
||||
1.4,10.4926725449224,9.87196343858118,-49.1710385129448
|
||||
1.6,10.356117268364,9.91845808035504,-49.2058495427448
|
||||
1.8,10.1672046643848,9.64863974440057,-49.4642747962812
|
||||
2,9.98371896733298,10.0489454085393,-49.6339775756903
|
||||
2.2,10.2897706772276,10.1953515177531,-49.4080450745775
|
||||
2.4,10.2154195630226,10.1005396245918,-49.9946687276308
|
||||
2.6,10.2577050281575,10.0217419552126,-49.8180134549818
|
||||
2.8,9.98933667159763,10.1703619223993,-49.8342589323192
|
||||
3,9.76445626977866,9.95409382024218,-49.5329182508216
|
||||
3.2,10.4973636674208,10.321144574179,-50.1510112446905
|
||||
3.4,10.5131141905399,9.91682657509507,-50.0799142412413
|
||||
3.6,10.2474449706573,9.94300048531368,-50.2391787433422
|
||||
3.8,9.92795091108018,9.8914478093147,-49.7045420451807
|
||||
4,10.3044684137222,10.176419741721,-49.8701851708707
|
||||
4.2,10.3587617715096,10.0225299219075,-50.2596180502069
|
||||
4.4,9.72096431734131,10.1310766816587,-50.2277667202859
|
||||
4.6,10.3451590724748,10.0857679491412,-49.869515027546
|
||||
4.8,10.4911129931929,9.93951120582113,-50.364009806125
|
||||
5,10.7375350141524,9.95499349881361,-50.4018512607067
|
||||
5.2,10.5668677830247,9.65849092825681,-50.1247524449039
|
||||
5.4,9.98534207063043,9.95162352497985,-50.0281115011664
|
||||
5.6,10.4052703406116,9.92568174158202,-50.0198204010102
|
||||
5.8,10.0478822228873,9.92191510069717,-50.1982742994271
|
||||
6,10.3885090061253,9.96386827893784,-50.0289867677549
|
||||
6.2,10.3164204622796,9.78293272707464,-50.3685400293169
|
||||
6.4,10.5654917069159,10.057645292927,-50.1027114873039
|
||||
6.6,10.0742941641833,10.10331444013,-50.0084382922197
|
||||
6.8,10.9301494857231,9.93567427648446,-49.9999091731551
|
||||
7,10.5211449691845,9.69396808955371,-49.9799284844214
|
||||
7.2,10.1222181896493,9.65166780135386,-49.8409945900613
|
||||
7.4,10.5271165235609,9.84343754407913,-50.4281231120201
|
||||
7.6,10.0503330988922,9.97568360565422,-50.2253786908635
|
||||
7.8,10.4220724920378,9.88538427443598,-50.1170870305113
|
||||
8,9.7742685481662,10.0201031702829,-49.7893404383201
|
||||
8.2,10.3073673833467,10.3400651397408,-50.0199531337098
|
||||
8.4,10.1678606198005,10.3123303931637,-50.1244002301166
|
||||
8.6,10.3048891965948,9.87184401433557,-49.7614304353709
|
||||
8.8,10.1524806616807,10.1208267669686,-50.1126526526534
|
||||
9,10.1092530880275,10.2183141122933,-49.7963406883673
|
||||
9.2,9.95937025270774,9.81521146970763,-49.982111021266
|
||||
9.4,9.93112355184742,9.75852421309146,-50.2158303996927
|
||||
9.6,9.96949809636019,9.95702582280807,-49.9212995325935
|
||||
9.8,9.86873797978281,10.0022541549996,-49.8604944399288
|
||||
10,10.0249475709179,10.0023698021325,-49.8528436893901
|
||||
10.2,10.3560246679171,10.0545767868028,-50.2619180715154
|
||||
10.4,10.0979569210208,10.3138592260903,-49.7213941685834
|
||||
10.6,10.0010593200181,10.2185293193811,-50.0651060123054
|
||||
10.8,9.99185141185049,10.4886788344927,-49.9361100358783
|
||||
11,10.0605413335801,11.1843256439184,-50.4398556248576
|
||||
11.2,10.1131155281688,11.7363291819528,-49.9630233405514
|
||||
11.4,9.88565276873762,11.6785946404047,-50.083456244712
|
||||
11.6,10.2586959819315,12.6642473293169,-49.9621623404152
|
||||
11.8,10.217128623716,13.5061473306208,-50.5305673109408
|
||||
12,10.4242556999092,14.3813222016999,-49.5872231156197
|
||||
12.2,10.5441278273735,14.688026838588,-50.0528176231517
|
||||
12.4,9.78012678102134,15.3256584411163,-49.9814219728702
|
||||
12.6,9.95039024714207,15.4362597722046,-50.0326773328145
|
||||
12.8,9.86319143927108,16.0078738810147,-50.0976436782067
|
||||
13,10.0161114699074,16.6268966268657,-49.8608813943994
|
||||
13.2,10.0605631739419,17.2650487214126,-49.8137091822681
|
||||
13.4,9.8144972835773,17.4267367741303,-50.0652737851009
|
||||
13.6,10.190168316194,17.6945961364337,-49.6567390127647
|
||||
13.8,10.3727465441307,18.2107266326977,-49.9089384072756
|
||||
14,9.88626640179435,18.4629853178012,-49.9937461569728
|
||||
14.2,9.93289136268355,18.5036260005219,-50.2009864676883
|
||||
14.4,10.0091260368783,18.8064069790244,-50.1923505504929
|
||||
14.6,9.98031707173438,19.0060368884828,-49.8869735485413
|
||||
14.8,9.81870942833796,19.2699646375768,-49.7650885821756
|
||||
15,9.89478679318152,19.4057374232795,-50.0355570149955
|
||||
15.2,10.3283170567001,19.6222311513207,-49.812746574628
|
||||
15.4,10.1259721014852,19.6551244534423,-50.1007544495645
|
||||
15.6,9.67598114099343,19.9292906305736,-50.3414278274402
|
||||
15.8,10.2186963467689,20.1735963251321,-49.9263149577276
|
||||
16,9.94276726073285,20.0019686232287,-50.1415883236908
|
||||
16.2,10.4624137645555,19.6472173351956,-49.8262800326937
|
||||
16.4,9.61415642546076,20.3664974238939,-50.5282376878066
|
||||
16.6,10.1847108971815,20.1568083203607,-49.9343046050609
|
||||
16.8,10.0596122966129,20.2703302216485,-49.8309942518136
|
||||
17,9.75373878577932,19.9211150293114,-50.0246740203845
|
||||
17.2,9.96465975955818,19.855527279965,-49.6123429694529
|
||||
17.4,10.0604738910755,20.4405190985749,-49.8144104408114
|
||||
17.6,9.82879422181191,20.0115776262547,-49.9450698055833
|
||||
17.8,10.1090100235798,19.7693567732247,-50.0005461912203
|
||||
18,10.0237327688179,19.7124145614062,-49.8886234171343
|
||||
18.2,10.2205420312953,20.0011437906349,-50.0797188119504
|
||||
18.4,10.0649161980431,20.2165417872633,-49.7637094020678
|
||||
18.6,9.9690894535122,20.0001370970798,-49.8766442441432
|
||||
18.8,9.97513011794753,19.9001763572736,-49.8561904964856
|
||||
19,10.2821146668555,20.0474099770066,-49.8477244261914
|
||||
19.2,10.3065392198017,20.2602080688025,-50.3007432653942
|
||||
19.4,10.1529521657026,20.1678310825619,-49.9978216552321
|
||||
19.6,10.3377737418779,19.9427408252664,-50.163595918024
|
||||
19.8,10.4162192638422,19.8141979088266,-49.885081957765
|
||||
20,9.84769818960841,19.880835150581,-49.7951369575064
|
||||
20.2,10.2450835788726,19.9771673144304,-50.3913923674659
|
||||
20.4,10.4535765409027,19.9444512436681,-50.14431270919
|
||||
20.6,10.2270033173011,20.2950609495955,-50.2927119644909
|
||||
20.8,9.94899936010159,20.0270528948297,-51.1556555862703
|
||||
21,10.118250636155,20.2710239323044,-51.45750602708
|
||||
21.2,9.95082227534367,20.0911580389743,-51.6912679699131
|
||||
21.4,10.3097445817238,20.0574941720735,-52.348531870536
|
||||
21.6,10.2740690521167,20.1038846081074,-52.4246328091767
|
||||
21.8,9.96906177197776,20.3874203179592,-53.6267504580339
|
||||
22,9.94116700263683,20.024831404662,-53.9176514449092
|
||||
22.2,10.5488401041558,20.0400611969785,-54.5910089450091
|
||||
22.4,10.6619748715194,19.7312378144378,-54.7296094676322
|
||||
22.6,10.4919662577556,20.2472802896777,-55.1388095908327
|
||||
22.8,10.1370351389821,20.111838357182,-55.4107008488297
|
||||
23,10.1807158744296,19.7800946880655,-56.4087853904201
|
||||
23.2,10.3752482532962,20.5492193118077,-56.8043170077019
|
||||
23.4,10.1765557309236,20.0197034026074,-57.186839024696
|
||||
23.6,10.1168935029284,20.1187218179101,-57.7081602553977
|
||||
23.8,10.1996809059757,20.5838916934161,-58.4170485102233
|
||||
24,10.2002603110804,20.2412353547054,-58.4925058165442
|
||||
24.2,9.97576992229521,20.125109169597,-58.8302031770956
|
||||
24.4,10.1045913174276,20.4940112487282,-59.5958471493343
|
||||
24.6,9.96223241116173,20.1640612908448,-60.1181721180645
|
||||
24.8,9.88359191658602,20.1201381757994,-60.65299350753
|
||||
25,10.1203381580362,19.8566205918716,-61.2079176724538
|
||||
25.2,10.0257687847175,20.0315630838018,-61.2995815041897
|
||||
25.4,9.82892943371075,20.2459594962102,-61.9899616261253
|
||||
25.6,10.0629730536,20.1740288735645,-62.5059640872033
|
||||
25.8,9.99761401222963,19.991378738985,-62.5482541428058
|
||||
26,9.99251362340503,20.0467415267431,-63.9862775148448
|
||||
26.2,9.95044472026862,20.2188479494575,-63.7847425738963
|
||||
26.4,10.0963115009352,19.8741872866968,-64.0938676733128
|
||||
26.6,10.3904349536819,20.0693199569035,-64.7794303508581
|
||||
26.8,10.0755141108344,19.8269264247667,-65.4613245843372
|
||||
27,9.72290673122615,20.2340443422518,-65.7277859710886
|
||||
27.2,10.4173456669143,20.1893641418585,-66.204970059963
|
||||
27.4,10.1791918621935,19.8081467839711,-66.633875354138
|
||||
27.6,10.2433932472471,20.2408819678735,-67.2054386609192
|
||||
27.8,10.152946147676,20.2344338778369,-67.6650382448658
|
||||
28,10.0622457186651,20.5128592491618,-68.1046104412781
|
||||
28.2,10.0203053090674,19.9845602511405,-68.8450599591253
|
||||
28.4,10.283432601868,20.1210039832812,-68.8866917755639
|
||||
28.6,9.98182604708019,20.1818268689101,-69.6825897406584
|
||||
28.8,9.89321707679076,20.083931450282,-70.2132370417174
|
||||
29,10.000355597631,19.8942303947814,-70.5098492304037
|
||||
29.2,9.96410425802319,20.2532733993794,-71.3502564361399
|
||||
29.4,10.3024083224748,20.3184600067356,-71.5605463371551
|
||||
29.6,9.98870933327189,20.3595492839205,-71.9056251838607
|
||||
29.8,9.94240476403997,20.3062578780236,-72.64170403321
|
||||
30,10.1537564592093,20.1864851403063,-73.1448890411925
|
||||
30.2,10.1029578418763,20.371317670649,-73.4020515265366
|
||||
30.4,10.2367615743883,19.7228733882347,-73.3690407804466
|
||||
30.6,10.0611381690469,19.6841739515515,-74.5009977366804
|
||||
30.8,10.1772844088299,19.3007944322262,-74.6602556849799
|
||||
31,10.4809399095965,19.0201286283463,-75.3884795304657
|
||||
31.2,11.0728950037855,18.5092583825169,-75.3842932710484
|
||||
31.4,10.9715052896173,17.4545755427995,-76.2516813900874
|
||||
31.6,10.917987418806,17.0142042404216,-76.592999970965
|
||||
31.8,11.739104838414,15.5610847782752,-76.9851371171707
|
||||
32,11.8821714216652,15.0564536948282,-77.2592079464681
|
||||
32.2,12.6945412311368,13.3927722845178,-78.0960889531981
|
||||
32.4,13.4257883147839,12.3884979667463,-78.4629458771201
|
||||
32.6,13.8354868877321,11.2496799892641,-79.1275180620487
|
||||
32.8,14.2922871678559,9.44649115966886,-79.3520787650201
|
||||
33,15.4910864476979,7.7386002637198,-79.7186828333987
|
||||
33.2,15.8031080801182,6.27742890624728,-80.229507609566
|
||||
33.4,16.9471213233603,4.58959248388519,-80.602014486598
|
||||
33.6,17.5458417126796,2.79122257964512,-81.5276554050231
|
||||
33.8,18.4171580772655,1.05097979316253,-82.1751152471181
|
||||
34,19.4900388746465,-0.53128644384821,-81.8036926448661
|
||||
34.2,20.0191732661295,-2.12694629970935,-82.3212491076219
|
||||
34.4,20.9660050866271,-4.11656044525489,-82.938223076102
|
||||
34.6,21.4941619957878,-5.64363087323882,-83.8462442821497
|
||||
34.8,22.6911078417064,-6.92897558441035,-84.4652133354006
|
||||
35,23.1991914267532,-8.77644694505026,-84.6981330035528
|
||||
35.2,24.2896691731264,-9.99291707933878,-84.7750072563142
|
||||
35.4,24.8918887477285,-11.1835081601714,-85.7466615185827
|
||||
35.6,25.0647881339418,-12.1690033685556,-85.9616667916485
|
||||
35.8,26.1054995111093,-12.8869092310697,-86.4729558063932
|
||||
36,26.2762662234051,-14.0502132998176,-86.9067707023376
|
||||
36.2,26.6396257903386,-14.9217714046287,-87.5354643418446
|
||||
36.4,27.1805405828654,-15.4440111776893,-87.6527254731252
|
||||
36.6,28.0588060266943,-16.1786255453396,-88.3909185393459
|
||||
36.8,27.7739732428074,-16.6823887005978,-88.7241118647285
|
||||
37,28.2922061040712,-17.4904136236609,-89.0872672550489
|
||||
37.2,28.4603660874617,-17.7453725312422,-89.2213964569885
|
||||
37.4,28.5177811778011,-18.1122267265671,-89.9634269583451
|
||||
37.6,29.057929139963,-18.6806677173854,-90.4810611368262
|
||||
37.8,29.4362868613982,-18.4854759797621,-90.8253174459728
|
||||
38,29.260932448025,-19.0770586665743,-91.5219158462202
|
||||
38.2,29.2344482342891,-19.4397692518233,-92.0169774224254
|
||||
38.4,29.7248400252309,-19.1970095589755,-92.5637537985561
|
||||
38.6,29.5858190394237,-19.6211701599248,-92.9319295890113
|
||||
38.8,29.8390147786606,-19.7723783799166,-93.5970556770264
|
||||
39,29.9242758697111,-19.7129027755737,-94.113909293699
|
||||
39.2,30.1608326430829,-19.9253198905389,-94.818792538961
|
||||
39.4,29.9104706814784,-20.0568816342095,-94.9567623062198
|
||||
39.6,29.6038969532074,-20.0149311544964,-95.4359134151444
|
||||
39.8,29.6901992450042,-19.9071087109537,-95.8600915435522
|
||||
40,30.2563343882793,-20.4271557291091,-96.5387316833083
|
||||
40.2,30.1512534214306,-19.9420752763062,-97.1049152631042
|
||||
40.4,30.418269207361,-20.101148290722,-97.3446242898368
|
||||
40.6,30.2425802388986,-19.8798372434416,-97.8708002707735
|
||||
40.8,30.2021536490244,-20.0788526492493,-98.3231576320178
|
||||
41,29.9356228939631,-19.505342951922,-98.3334569834568
|
||||
41.2,29.7558034694625,-19.8137375198047,-98.7979860258366
|
||||
41.4,30.0675879584511,-20.3719855484847,-98.9853329284705
|
||||
41.6,29.9371251528581,-20.4053792891596,-99.4010006305474
|
||||
41.8,29.8144298213204,-19.9590816527569,-99.7536901438478
|
||||
42,30.0145149243559,-20.0968393077,-100.045405980148
|
||||
42.2,29.9446060481337,-20.2564513268186,-100.141599228655
|
||||
42.4,29.9854424360506,-20.3173176038056,-100.270302324605
|
||||
42.6,29.9694064541263,-20.1465200206697,-100.279014590733
|
||||
42.8,30.1214891074745,-19.801979967646,-100.031520493606
|
||||
43,29.7194783501313,-20.2873533881231,-100.161535133542
|
||||
43.2,29.9698706279985,-20.3121434966789,-100.352850875373
|
||||
43.4,29.982425994092,-20.3578213613122,-100.079931474009
|
||||
43.6,30.2373630223169,-19.8149234807024,-100.2977969145
|
||||
43.8,29.9176230010032,-20.1013928629295,-100.44782255728
|
||||
44,29.8696820094227,-19.6759963955318,-100.470241137617
|
||||
44.2,30.324589442623,-19.7547586712368,-100.416505994633
|
||||
44.4,29.998690337126,-20.2801150247482,-100.243632430271
|
||||
44.6,29.9860047411966,-20.2677771644314,-100.147673714649
|
||||
44.8,30.0945392543469,-20.0636613377991,-100.252787848497
|
||||
45,30.1231863949948,-19.8176624438173,-100.02419741515
|
||||
45.2,30.028398859836,-19.8217063105551,-100.137691271125
|
||||
45.4,30.2850654523987,-20.1637703554842,-100.139634805175
|
||||
45.6,30.1868442103537,-20.2467163396603,-100.052662265472
|
||||
45.8,29.8866325802406,-19.9602638725475,-100.028402413597
|
||||
46,30.0613190215948,-19.947254391353,-100.293667534077
|
||||
46.2,30.0391815941626,-20.1350942869234,-100.310952223106
|
||||
46.4,30.1672914734888,-20.016258185286,-100.158523831249
|
||||
46.6,30.229455329798,-19.7257197232393,-100.237778357928
|
||||
46.8,30.4101077077452,-19.7228807618842,-100.007110478929
|
||||
47,29.7964770700409,-20.1459151397686,-100.089092023789
|
||||
47.2,30.0755695859668,-19.6840157511618,-99.9758583597949
|
||||
47.4,30.5184929210554,-20.2213479554095,-100.142954428822
|
||||
47.6,30.4277911360329,-19.9281297629218,-100.03493579821
|
||||
47.8,30.0323270822282,-20.1168886275458,-100.284217810199
|
||||
48,29.7750201002284,-19.7635322950336,-99.5377485462339
|
||||
48.2,30.2521950000127,-20.0409140855124,-99.8066844943577
|
||||
48.4,30.5258941356814,-20.0771210980262,-100.649583459748
|
||||
48.6,29.5897303703843,-19.5819669785277,-99.7386252688036
|
||||
48.8,30.1669161546943,-19.9898263021217,-99.9106996597392
|
||||
49,30.1693010697655,-19.7061560130005,-99.7879625111351
|
||||
49.2,30.2331968239689,-19.7102927652757,-99.8153063272832
|
||||
49.4,30.4190871796675,-19.6402004824625,-99.8002218595
|
||||
49.6,30.3834805528666,-19.5399161113867,-99.7012982349569
|
||||
49.8,30.3536708010564,-19.6611669470545,-99.9143659188667
|
||||
50,30.1136226226417,-19.712025178162,-99.9086365040418
|
30002
data/IMU_M1H.txt
Normal file
30002
data/IMU_M1H.txt
Normal file
File diff suppressed because it is too large
Load Diff
6002
data/IMU_M1L.txt
Normal file
6002
data/IMU_M1L.txt
Normal file
File diff suppressed because it is too large
Load Diff
50003
data/IMU_M2H.txt
Normal file
50003
data/IMU_M2H.txt
Normal file
File diff suppressed because it is too large
Load Diff
10002
data/IMU_M2L.txt
Normal file
10002
data/IMU_M2L.txt
Normal file
File diff suppressed because it is too large
Load Diff
30002
data/N_truth_IMU_M1H.txt
Normal file
30002
data/N_truth_IMU_M1H.txt
Normal file
File diff suppressed because it is too large
Load Diff
6002
data/N_truth_IMU_M1L.txt
Normal file
6002
data/N_truth_IMU_M1L.txt
Normal file
File diff suppressed because it is too large
Load Diff
4
main.py
4
main.py
@ -20,7 +20,11 @@ folders = ["./images"]
|
||||
for folder in folders:
|
||||
if not os.path.isdir(folder): os.mkdir(folder)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
pass
|
||||
|
||||
if __name__ == '__main__1':
|
||||
#This is an example of drawing 4 plots by generating them
|
||||
graphData = {
|
||||
"figTitle": "Simple Plot",
|
||||
|
82
makeGraph.py
82
makeGraph.py
@ -6,7 +6,7 @@
|
||||
#### 2023 - Added UQ Default Colours to MatPlotLib
|
||||
|
||||
__author__ = "Cal Wing"
|
||||
__version__ = "0.1.9"
|
||||
__version__ = "0.1.10"
|
||||
|
||||
from collections.abc import Iterator
|
||||
import numpy as np
|
||||
@ -190,7 +190,7 @@ def colorbar(mappable, size="5%", pad=0.05, lsize=None, lpad=None, lax=True, **k
|
||||
|
||||
|
||||
## Make Graph Function
|
||||
def makeGraph(graphData, showPlot=True, doProgramBlock=True, figSavePath=None) -> tuple[matplotlib.figure.Figure, tuple[matplotlib.axes.Axes, ...]]:
|
||||
def makeGraph(graphData, showPlot=True, doProgramBlock=True, figSavePath=None, hideEmptyAxis=False) -> tuple[matplotlib.figure.Figure, tuple[matplotlib.axes.Axes, ...]]:
|
||||
""" Generate a matplotlib graph based on a simple dictionary object
|
||||
Input:
|
||||
dict(graphData): The dictionary containing all the graph data - see example for more info
|
||||
@ -242,7 +242,8 @@ def makeGraph(graphData, showPlot=True, doProgramBlock=True, figSavePath=None) -
|
||||
loopKeys = [
|
||||
"xLabel", "yLabel", "title", "axis", "grid", "xPos", "yPos",
|
||||
"xLabelPos", "yLabelPos", "xTickPos", "yTickPos", "xScale", "yScale",
|
||||
"xTickMap", "yTickMap", "plots", "xLim", "yLim"
|
||||
"xTickMap", "yTickMap", "plots", "xLim", "yLim", "ledgLoc", "y2Label",
|
||||
"ticklabel"
|
||||
]
|
||||
|
||||
#Feel like this could be optimized
|
||||
@ -256,7 +257,15 @@ def makeGraph(graphData, showPlot=True, doProgramBlock=True, figSavePath=None) -
|
||||
|
||||
|
||||
for i, axGraphData in enumerate(graphData["subPlots"]):
|
||||
ax = flatAxes[i]
|
||||
ax1 = flatAxes[i]
|
||||
|
||||
if bool(sum([("y2" in pData) for pData in axGraphData["plots"]])):
|
||||
ax2 = ax1.twinx()
|
||||
else:
|
||||
ax2 = None
|
||||
|
||||
# Duct Tape
|
||||
ax = ax1
|
||||
|
||||
#Draw many plots as needed
|
||||
# Also provide functions for drawing other types of lines
|
||||
@ -267,28 +276,38 @@ def makeGraph(graphData, showPlot=True, doProgramBlock=True, figSavePath=None) -
|
||||
getSafeColour = getSafeValue("colour") or getSafeValue("color") #Frigen American Spelling
|
||||
optArgs = getSafeValue("args", {}) #Allow for other args to be passed in
|
||||
|
||||
if "x" in pData:
|
||||
xData = pData["x"]
|
||||
|
||||
if "y" in pData:
|
||||
yData = pData["y"]
|
||||
elif "y2" in pData:
|
||||
yData = pData["y2"]
|
||||
ax = ax2
|
||||
|
||||
if "type" not in pData or pData["type"] == "plot":
|
||||
ax.plot(pData["x"], pData["y"], label=getSafeValue("label"), color=getSafeColour, **optArgs)
|
||||
ax.plot(xData, yData, label=getSafeValue("label"), color=getSafeColour, **optArgs)
|
||||
elif pData["type"] == "point":
|
||||
ax.scatter(pData["x"], pData["y"],
|
||||
ax.scatter(xData, yData,
|
||||
marker=getSafeValue("marker"), label=getSafeValue("label"),
|
||||
color=getSafeColour, zorder=getSafeValue("zorder", 2),
|
||||
**optArgs )
|
||||
elif pData["type"] == "hLine":
|
||||
ax.hlines(pData["y"], *pData["x"], label=getSafeValue("label"), color=getSafeColour, **optArgs)
|
||||
ax.hlines(yData, *xData, label=getSafeValue("label"), color=getSafeColour, **optArgs)
|
||||
elif pData["type"] == "vLine":
|
||||
ax.vlines(pData["x"], *pData["y"], label=getSafeValue("label"), color=getSafeColour, **optArgs)
|
||||
ax.vlines(xData, *yData, label=getSafeValue("label"), color=getSafeColour, **optArgs)
|
||||
elif pData["type"] == "axvLine":
|
||||
if "y" not in pData: pData["y"] = (0, 1) #Span the whole graph
|
||||
ax.axvline(pData["x"], *pData["y"], label=getSafeValue("label"), color=getSafeColour, **optArgs)
|
||||
if "y" not in pData: yData = (0, 1) #Span the whole graph
|
||||
ax.axvline(xData, *yData, label=getSafeValue("label"), color=getSafeColour, **optArgs)
|
||||
elif pData["type"] == "axhLine":
|
||||
if "x" not in pData: pData["x"] = (0, 1) #Span the whole graph
|
||||
ax.axhline(pData["y"], *pData["x"], label=getSafeValue("label"), color=getSafeColour, **optArgs)
|
||||
if "x" not in pData: xData = (0, 1) #Span the whole graph
|
||||
ax.axhline(yData, *xData, label=getSafeValue("label"), color=getSafeColour, **optArgs)
|
||||
elif pData["type"] == "scatter":
|
||||
ax.scatter(xData, yData, marker=getSafeValue("marker"), label=getSafeValue("label"), color=getSafeColour, **optArgs)
|
||||
|
||||
elif pData["type"] == "contour":
|
||||
cs = ax.contour(getSafeValue("x"), getSafeValue("y"), pData["z"], levels=getSafeValue("levels"), colors=getSafeColour, **optArgs)
|
||||
if "label" in pData: cs.collections[0].set_label(getSafeValue("label"))
|
||||
elif pData["type"] == "scatter":
|
||||
ax.scatter(pData["x"], pData["y"], marker=getSafeValue("marker"), label=getSafeValue("label"), color=getSafeColour, **optArgs)
|
||||
elif pData["type"] == "matshow":
|
||||
ms = ax.matshow(pData["matrix"], origin=getSafeValue("origin"), label=getSafeValue("label"), **optArgs)
|
||||
if "colourBar" in pData:
|
||||
@ -296,9 +315,9 @@ def makeGraph(graphData, showPlot=True, doProgramBlock=True, figSavePath=None) -
|
||||
elif pData["type"] == "pColourMesh":
|
||||
mesh = []
|
||||
if "X" in pData or "Y" in pData:
|
||||
mesh = [pData["X"], pData["Y"], pData["Z"]]
|
||||
mesh = [xData, yData, pData["Z"]]
|
||||
if "x" in pData or "y" in pData:
|
||||
x = pData["x"]; y = pData["y"]
|
||||
x = xData; y = yData
|
||||
|
||||
if type(x) in [int, float]: x = (0, x, None)
|
||||
if type(y) in [int, float]: y = (0, x, None)
|
||||
@ -352,8 +371,10 @@ def makeGraph(graphData, showPlot=True, doProgramBlock=True, figSavePath=None) -
|
||||
|
||||
|
||||
#Set extra options as needed
|
||||
ax = ax1
|
||||
if "xLabel" in axGraphData: ax.set_xlabel(axGraphData["xLabel"]) # Add an x-label to the axes.
|
||||
if "yLabel" in axGraphData: ax.set_ylabel(axGraphData["yLabel"]) # Add an y-label to the axes.
|
||||
if "y2Label" in axGraphData: ax2.set_ylabel(axGraphData["y2Label"]) # Add a y2-label to the axes.
|
||||
if "title" in axGraphData: ax.set_title(axGraphData["title"]) # Add an title to the axes.
|
||||
if "axis" in axGraphData: ax.axis(axGraphData["axis"]) # Set the axis type
|
||||
if "grid" in axGraphData: ax.grid(axGraphData["grid"]) # Add grids to the graph
|
||||
@ -389,8 +410,29 @@ def makeGraph(graphData, showPlot=True, doProgramBlock=True, figSavePath=None) -
|
||||
if "yTickMap" in axGraphData: #Allow for the mapping / transformation of the yAxis Ticks
|
||||
yTicks = matplotlib.ticker.FuncFormatter(lambda y, pos: '{0:g}'.format(axGraphData["yTickMap"](y)))
|
||||
ax.yaxis.set_major_formatter(yTicks)
|
||||
|
||||
if "plots" in axGraphData and bool(sum([("label" in pData) for pData in axGraphData["plots"]])):
|
||||
ax.legend() #Only draw the legend if there are any defined
|
||||
locPoint = axGraphData["ledgLoc"] if "ledgLoc" in axGraphData else None
|
||||
lines1, labels1 = ax1.get_legend_handles_labels()
|
||||
|
||||
if ax2:
|
||||
lines2, labels2 = ax2.get_legend_handles_labels()
|
||||
ax2.legend(lines1 + lines2, labels1 + labels2, loc=locPoint)
|
||||
else:
|
||||
ax1.legend(lines1, labels1, loc=locPoint)
|
||||
|
||||
if "ticklabel" in axGraphData:
|
||||
style = axGraphData["ticklabel"]["style"] if "style" in axGraphData["ticklabel"] else ""
|
||||
axis = axGraphData["ticklabel"]["axis"] if "axis" in axGraphData["ticklabel"] else "both"
|
||||
limits = axGraphData["ticklabel"]["limits"] if "limits" in axGraphData["ticklabel"] else None
|
||||
optArgs = axGraphData["ticklabel"]["optArgs"] if "optArgs" in axGraphData["ticklabel"] else {}
|
||||
ax.ticklabel_format(axis=axis, style=style, scilimits=limits, **optArgs)
|
||||
|
||||
#Should work?
|
||||
if hideEmptyAxis:
|
||||
if not ax.collections and not ax.lines:
|
||||
ax.set_axis_off()
|
||||
|
||||
|
||||
if "title" in graphData and not "figTitle" in graphData: fig.canvas.manager.set_window_title(graphData["title"].replace("\n", " ")) #Set the figure title correctly
|
||||
if "figTitle" in graphData:
|
||||
@ -400,7 +442,11 @@ def makeGraph(graphData, showPlot=True, doProgramBlock=True, figSavePath=None) -
|
||||
fig.canvas.manager.set_window_title(graphData["figTitle"].replace("\n", " "))
|
||||
|
||||
fig.tight_layout() #Fix labels being cut off sometimes
|
||||
|
||||
|
||||
#Very big hack
|
||||
if hideEmptyAxis:
|
||||
flatAxes[-1].set_axis_off()
|
||||
|
||||
if figSavePath:
|
||||
fig.savefig(figSavePath)
|
||||
|
||||
|
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user