{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# GGBunch\n", "\n", "*GGBunch* allows to show a collection of plots on one figure. Each plot in the collection can have arbitrary location and size. There is no automatic layout inside the bunch." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ " <div id=\"wKqGUr\"></div>\n", " <script type=\"text/javascript\" data-lets-plot-script=\"library\">\n", " if(!window.letsPlotCallQueue) {\n", " window.letsPlotCallQueue = [];\n", " }; \n", " window.letsPlotCall = function(f) {\n", " window.letsPlotCallQueue.push(f);\n", " };\n", " (function() {\n", " var script = document.createElement(\"script\");\n", " script.type = \"text/javascript\";\n", " script.src = \"https://cdn.jsdelivr.net/gh/JetBrains/lets-plot@v2.3.0/js-package/distr/lets-plot.min.js\";\n", " script.onload = function() {\n", " window.letsPlotCall = function(f) {f();};\n", " window.letsPlotCallQueue.forEach(function(f) {f();});\n", " window.letsPlotCallQueue = [];\n", " \n", " \n", " };\n", " script.onerror = function(event) {\n", " window.letsPlotCall = function(f) {};\n", " window.letsPlotCallQueue = [];\n", " var div = document.createElement(\"div\");\n", " div.style.color = 'darkred';\n", " div.textContent = 'Error loading Lets-Plot JS';\n", " document.getElementById(\"wKqGUr\").appendChild(div);\n", " };\n", " var e = document.getElementById(\"wKqGUr\");\n", " e.appendChild(script);\n", " })();\n", " </script>" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%useLatestDescriptors\n", "%use lets-plot\n", "\n", "@file:DependsOn(\"org.apache.commons:commons-math3:3.6.1\")" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import kotlin.random.Random\n", "import org.apache.commons.math3.distribution.MultivariateNormalDistribution" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "val cov : Array<DoubleArray> = arrayOf(doubleArrayOf(1.0, 0.0),\n", " doubleArrayOf(0.0, 1.0))\n", "val means : DoubleArray = doubleArrayOf(0.0, 0.0)\n", "val xy = MultivariateNormalDistribution(means, cov).sample(400)\n", "\n", "val xs = xy.map { it[0] }\n", "val ys = xy.map { it[1] }" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### View this data as a scatter plot and as a histogram" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ " <div id=\"yD1Z0H\"></div>\n", " <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n", " (function() {\n", " var plotSpec={\n", "\"mapping\":{\n", "},\n", "\"ggsize\":{\n", "\"width\":600.0,\n", "\"height\":200.0\n", "},\n", "\"kind\":\"plot\",\n", "\"scales\":[],\n", "\"layers\":[{\n", "\"mapping\":{\n", "\"x\":\"x\",\n", "\"y\":\"y\"\n", "},\n", "\"stat\":\"identity\",\n", "\"color\":\"black\",\n", "\"alpha\":0.4,\n", "\"position\":\"identity\",\n", "\"geom\":\"point\",\n", "\"data\":{\n", "\"x\":[-0.6744640199025198,1.1688609933155418,-0.7798635003683787,-1.0575765850104435,-0.21133517484449102,-0.43703695115361535,-1.164777495612634,-0.5814437773139531,1.4325041796167088,1.2263820001713754,1.1286164161324417,-0.22825957758128768,-0.4004713771601831,0.6664538499624992,-0.10279704526589616,-0.6718952577246665,0.11606385517388161,-2.158497089938217,0.32729536035251305,0.8410159607062793,-0.46849691977181085,-0.4109888165401843,-0.1859037174307802,0.17509272671447068,-0.415285336588659,-0.23822814898234984,0.8038433766389336,-0.5346942523026389,0.07625398874397708,-0.5820054223326827,-0.6455726139124609,0.5904200735386678,-2.2088222612659965,0.282563605446129,0.2456626168541644,-0.12972861958357146,1.9362386971988845,1.007454364566747,0.27505632953838816,1.67458063198,0.7911157220043826,-1.095892638267239,-1.1063779379551584,-0.1393810695701042,2.913288850052117,0.6904564793847627,0.7400690642955501,-0.46959889661032184,1.341406123781579,0.30664512125115884,-1.3263569627601735,1.038231141062499,-1.5174427563160675,0.6864031278524461,-0.7454420605309788,1.992713666493837,0.5593647083868054,0.45130115874528715,1.5425685716647353,-0.9605146246361498,-0.08523419271875438,1.111435961359105,-0.8524110466531205,0.1614934389407704,0.1571394859285564,1.067315278685693,0.621806599851275,1.5493862830807028,-1.1336113094003275,1.442415378514537,-0.6961723889302749,0.12197337141661355,-0.28392754338046744,-0.7038151371673095,-0.6878249924054599,0.6976187437879244,0.6273765488641239,-0.3993781932341655,-0.15560729174098611,-0.2806713570403014,0.5013085190606195,0.6106377354016977,-0.4893869942232398,1.9801775390874534,0.5741506800233674,-0.6724596427198881,-0.47822448541630436,0.27202580262527665,1.4280074398490983,1.0605876647876462,0.009427070708191973,0.3046331171047675,-0.5240961069893961,0.9141556511392445,2.0146839535666983,0.6579552852739827,0.3620035267256028,-0.6155136694769258,-1.3059734083292327,1.1804347811503173,-0.00878255187277409,-0.4855523693255114,-0.4268632688904139,1.3740850493928483,-0.5759900916662539,-0.3641767940830528,-0.6872737505724394,-0.6204913005009245,-1.062716561716572,1.0441178467310759,1.0574628436773703,0.2749536947264239,-0.05564571090795107,0.5898848385633713,-1.2574405331080798,-0.343856678542779,1.7727854698384218,0.44062598938709463,0.052173725141496353,-1.3419897472693638,-1.2485293393451584,-0.9858255966527361,-0.14233376465120176,-0.8906901957309995,0.1290914034077799,-1.2441492311975322,0.8606772012240371,-0.5732537081333599,-0.4747454050196354,-1.2777245800353252,0.6650410527153144,0.2736966295543624,0.275793362642477,1.2615129908036915,1.0741155929716693,0.07846385544461255,-0.38214793847042927,-0.4255912480644681,0.7930608875535996,-2.106753628258502,0.5475489356145378,0.4368452462753567,1.0161221301289975,-0.5632332300060781,-1.8477430614769195,-1.0472677511269095,-0.3542092544313052,-0.6163504115919833,-1.4453216467453514,-0.7544764199230152,0.35459637023800367,-1.5081932379179162,-1.6508922833016837,1.5797471495564652,-0.3090123656408648,-1.928443006525644,0.12391837091500493,1.2967316779965619,-0.7251034228383786,-0.0865116533475522,0.13270334003362758,-0.7070680026276068,-0.338809191616442,0.51292942969293,0.8850030193216443,-1.6038464582240335,-0.06380557043187186,1.3505934493395373,-1.1670499785467299,-0.05152331263614816,0.5785698151327001,0.14613622968091022,0.4421517291901596,0.9588054111507096,1.3711321535645093,0.23394531985372047,1.7482867092568144,-0.4252669320927708,0.8418949362763407,0.3551069063529994,1.0527696876422186,-0.6520396236217345,-0.22885246721890842,1.2840084983090168,-0.6881940466475199,0.16874703734057184,1.2727230364194406,0.36642299951376406,-0.6867301957900299,0.992305214707094,-0.20765586720306084,-0.5502492039908247,1.325219003277658,-2.2021464492971665,1.0054470224123828,-1.5772445879240753,-0.6078661269222209,-0.9048779353319325,-0.18187790309928129,-1.6172087565802113,-0.5463903345650736,-0.7703380148862496,0.3663034267556162,-0.6316812822572508,0.3080504688778069,-0.1908768968623617,-2.6963049137652613,0.10986883745211973,-1.0798596306307144,1.810514927017933,-0.6228312468938239,-0.2608657864505899,-0.13150365935394379,-0.467972547001626,1.797985242671896,0.1154289011371147,0.1595548347155912,-0.07393776081132851,0.5307735884849949,-1.022859114386942,-0.39298290799971497,0.7775511666560517,1.3725783778787235,-0.6289832768725503,-0.3961713261491232,-0.7141265366397814,1.9303813648030068,1.635166941821612,-0.5288559606592628,0.3823916781127417,-0.7867284817392186,-0.7514353671687319,0.42227776027954034,1.164734665795169,0.07448332065658074,-0.9513944136215156,0.15551831890151738,-1.2419776616947893,-0.19315370692280487,0.06301873859514497,-0.6683036338964441,-0.9810018132858906,-0.9984894495575073,-1.4858876828970087,1.023863492449694,-0.10755987494996634,0.41569482181237405,-0.22883460527361998,0.1853587129128223,0.7839560148234038,-0.5467427014709897,-1.338671276709058,0.318195841624596,1.4578434658924702,-0.2157935114973045,0.7901579860854885,0.008154189031804027,-0.7892662415596127,1.565774609411783,-0.7728112585429747,0.4813685943054223,-0.03555637763560912,-1.9570883274099817,0.3412855912215129,-0.2964533867494741,-1.3183553555323142,-1.1065204582306896,-0.18697235266440285,0.2210624987814711,-0.46804694996823515,-0.8709796665110143,-0.7491536758306041,-0.7373377424027923,1.3109038321853528,0.9242882106369306,1.1769784833105585,0.9548491991754234,1.0350417408583006,0.4240043021497952,-1.2509812748213214,-1.000617204015416,0.36864841621115024,0.33260744760968275,-1.206560499939688,0.6822030185642028,0.4729761182738336,0.4544524343009744,-0.35197522169199064,-0.11721057304590095,0.7016903092926798,1.0849161816518795,-0.7817242054666317,-0.7349145187158622,0.0063144856188233085,1.11192020239858,0.546813574410527,-0.8565734065917627,1.010644425113122,-0.3636820014661913,-1.1185560996978599,0.0681672427771298,-0.14090146398569794,1.5296031000730816,2.3639753311004954,0.49750518072204564,-1.012076584977165,0.586548738845585,-0.04060150187383195,1.093236677861897,-0.2189874966792859,-1.8543973631932458,-0.4918628070728557,0.23744916194094381,-0.0011216629891699754,-1.0633039037442018,0.8605154110028084,-0.024949637789862804,-1.1527172478944787,1.4640949689936218,-0.3648134482878574,-0.8490796069267117,0.058402753362986656,-0.44458011129741143,0.7428634562657651,-1.8210667548223796,0.3765034605130482,-0.8338884659358015,0.16728454677695495,-2.3764310421139307,-0.7816594611764757,1.3298731271168391,1.4290880297252289,-1.0451312953919853,-0.7922692863469232,0.261180836448762,0.8086315833784016,-0.9062271305897804,-0.7991779130868759,0.03404238715302243,0.2502286566601771,1.4967743097931494,0.23731823410810535,-1.0002542736029052,-0.6314434285522788,-0.03692412288482845,1.014056561922927,1.487643646810606,0.049615710675105736,-1.1145834188054784,0.7075326072412758,0.2712816584999319,-1.141908031042825,-0.9014366910920025,-0.09065973343509498,0.5082448338268991,-0.5599985658526059,0.5195560173676982,-0.9756539857667424,-0.3854980643799661,0.17324099945895904,2.0736451959971127,-1.4815292264732338,-0.5896044898970765,0.06952546624886935,0.1397733360451365,-0.6915365754281684,1.611269862564514,-0.7933328463910049,-0.5281587635918719,-0.6035286100309599,-0.9477183417341062,0.15498445359372398,-2.9880191108687817,-0.14845508081967465,-3.579194043126726,0.20764044930214787,0.2051333495616271,0.757197148229616,-0.8222884943170924,-0.2378240500504717,0.17179296925937573,0.8732075014438977,0.2147610851018894,0.7027551944543391,1.1095994434030567,-0.3876001734446714,-0.020310634441371968,0.674927289513476,-1.0355101392496213,2.2239167947252447,-1.0907579889739671,1.2864383960299692,0.794428024789826,0.5893058325723117,-0.08748679403195728,0.08993060728462124,-1.5811792996355263,1.2981338651688155,-0.1704016716225429,-1.6895124979602294],\n", "\"y\":[0.6661602010520571,1.270394779913487,-0.8057208237718527,1.735820325391944,0.7868455065432844,-0.17093352852816965,0.3447412143680761,-0.49870439796579213,1.9348226702746807,0.39668241487834416,1.2116230775512813,-0.5220070116369592,-0.925076710867466,0.8072362025186218,-0.40061881919633885,0.511028340092403,0.13725152337277255,-0.09419033560427485,0.8041814042307718,0.01967303568025677,-1.6015338416178044,0.5951910558078379,1.6806096679236213,0.7457129888784676,-2.0789763467307343,0.3412101846751085,0.11924010124190376,-1.1863467396888525,-0.15383189854418122,-0.4821865099703338,1.7467482414242215,-0.7006607639026755,-0.34773525036210706,-0.4151204967957861,-1.5032148285874696,-0.12529183593225476,0.6156337854767402,1.0993629219449024,-0.349634295623502,-0.6212616861123954,-1.419792938577749,-0.9717833353615182,-0.7069155215573859,-0.9496910845617567,-0.7867901733075993,0.511476561814012,0.41299416522189775,2.2576077474543155,0.04756504701604761,0.33630290766523036,-0.395634525321286,-0.2558607499857383,0.5413422961354568,1.3835682423938225,-0.6026172641494515,-0.21712271701580865,-0.6462257030121765,1.277547764420519,-1.1031886378891851E-4,0.7020194229609626,1.680110170634347,-0.7129559114154423,1.3124638577922958,0.6999069837652357,0.3687801010518353,0.48729408960506676,-1.9498325722776035,-0.41641852914490574,-1.5976165972731982,0.45300127300211934,-1.2458556398607952,0.5017029853261534,1.8652006385209974,0.5436923988427741,-0.9236901757070967,0.3890025423371501,-0.7499049670498529,0.7838730219418087,-1.6063029389504475,-0.008658674674104977,1.663716507212271,1.6852412396190222,0.6399942740853949,0.6805644526009091,0.3263252455603378,1.5360904505222914,-1.0308623290749828,-1.0590248837209169,0.7398169628587751,-1.9786633987987332,-0.48265117841086447,-0.3853938776245876,-0.2809202928613043,-0.16796591386658746,-1.2304759777310212,-1.109631165439823,-0.5773037006302898,1.3331144497076641,0.7503244906768306,0.4497678141094829,0.13607615677095608,-0.30423007635962607,0.07667780159047334,0.2539128195449736,0.28501837938448643,0.09700451749730972,-0.08220749654206347,-0.02659997793193712,-1.335049448682979,1.6929469381377789,0.3944413449819634,-1.2339544251330405,-0.2031091321032242,0.2469771245493247,-0.28499819749338784,0.367271636780082,-2.615485846927002,-0.17690338009758377,0.007401587665870942,0.8641096838523415,-0.24689236579662807,-0.04804891978589835,-1.4308661512054395,-0.31489533804846837,0.43597562169899956,-0.7834052471459008,-0.49494788373426246,0.10644118295037602,0.5888137968689542,2.266262715631338,0.29603195381193637,0.326015946425065,-1.3660486658948519,-0.9592409430165723,-0.0630237756444974,0.6985736113148365,0.8458839805024344,0.5152976969300707,-0.6042580318342613,-0.13261633603649114,-0.2877378427982844,0.33960954882708644,0.7513732025416191,-0.5407966984690689,1.1679653401843288,0.884312993997179,0.308535147323782,0.967351137961291,-0.4402244474693009,-1.0569358530671753,-0.07364049457009965,-1.294621789773702,1.0710564893126344,-0.9084820367832598,0.08135082296317361,0.11129637116824853,-1.0015276728748064,-2.4892824949118677,0.6045616863159997,-0.5935785984022471,0.501178731855949,0.8431846973874959,-0.34141204628342364,1.5600067687761343,1.28758871105485,1.461279487669829,-1.4994310598294114,0.2798786555448607,1.4061847172023074,-0.07224883348822239,-0.4104103269454383,0.49523688957468204,1.8351561198228457,-0.1639552903024566,1.4246619833172218,-0.685011120624986,0.273265833584567,-0.21924761496406908,-0.5035957928945841,0.6530931731693584,0.4750839038354609,-2.0274325134252034,-1.9065469128556307,1.2188414280921194,0.34362606643444693,-0.1526572696321081,-0.4698200482154767,0.4134218214559642,0.4252579808462775,-0.7321593578082719,-0.43525739769038074,-0.48625782977803605,-2.083035343824787,0.14384991642746636,-1.6529338266994753,-0.6350114758611285,-1.6681439164808158,-2.2276915053720994,0.1363831230758303,1.6163616972799912,-0.7459164843393543,2.1067030970715397,-0.17470801001639483,0.9910087384434383,-0.6814246302856187,0.3515225936187945,0.5640234935829792,-0.6740818463433754,-0.3935337290451268,-0.2393325269969546,0.24565191576507442,-0.5497986267759223,-0.13272532421753688,0.18605623512050912,1.5996079500350842,-0.3232125316252129,0.368077265338442,-1.2878746752950607,-0.029924290341881925,0.46483519582236765,0.21136854600086577,0.6603102954286026,-0.823471511909781,-0.08041298890549176,0.8644282304924725,-0.26616366911946066,-1.5566551664873147,0.4286117014945917,-0.6533287966519005,0.48835395302773776,1.6009930949035922,0.0631512638825802,-0.7415863591777397,0.47264996113012875,-0.9451334535711523,0.5295458199064564,-0.814412342292681,-0.8443886659659555,-1.8182723279942894,0.6687683849585785,-0.22905112746593675,-0.062242134943014234,1.5318333731381506,1.1946830035154299,-0.364361633199291,-0.9883269899587411,-1.031772402899363,-1.6418495968573268,0.8328566651733088,-0.57751062549269,-1.6900832557944294,1.6678024876651931,-0.7120529334191709,0.5861777009912414,-0.18733380973234726,0.621700061233281,-0.6716112883678875,-1.6563930622412077,-1.876144320075645,-1.457109956054859,0.2419744211596227,-1.1005627519199772,1.1039546818963242,2.6997786595999957,-0.3620843714884368,1.55354842399825,0.5972181692598149,0.44283010806347967,-1.4680658662958304,-2.267316249485942,-1.0487421799045624,-0.018596681165419023,-0.8001970740422907,-1.406450107673903,-0.5509049056739228,0.6754627588178578,-0.06884619560386458,-0.42782431758530143,1.2213749520812753,-1.5902454518427525,-0.844842017372366,1.8877488199738104,1.7017554253461908,0.5246189289944397,-0.9287646730712531,-1.4517564224839037,0.5122933201712003,-0.19647652499600554,-0.7417421487177752,-1.2163309507935638,0.2880900728298288,-1.7780969866913972,-0.5805496197755603,-0.3800594716663436,-1.3112561573749872,-1.2373128133396845,-0.09456367364942278,-0.7245060018671905,1.971038301776271,1.1220550741127149,0.04202960869284377,0.011016378533954742,-1.3713917193129093,-0.7614790341645236,0.20864574248058737,-1.6797548037073005,-0.27943214388735954,0.845984890866596,-0.32354589715107107,-0.16646427590890103,1.12420618678173,-0.8111943161922545,-0.5580894017246969,-0.43189136749197027,-0.20865026057767122,0.5080631258988317,0.12486086720026708,0.17917070373765018,0.002132960571923035,0.5878865536896458,0.16979301793813076,-0.16138332018055732,-0.5539608098814934,0.4020107395019965,-1.3356990444959138,-0.22929716389461488,-0.016639210193379956,0.17449713411670062,-0.34002052123609006,-1.0242903068489628,0.7661025666586033,0.43135537241935323,0.3830984050562818,0.029341773251223342,-0.9524355819861764,-1.8487919864514415,-0.5333783323331674,-1.310297183757364,-1.962779314560478,-0.29586294472753555,1.2601905199713175,0.2258623335479983,1.164028842034106,1.2601762485889645,-1.6198229221332971,-0.19940094653650764,0.9351061044738597,-0.8723662733450582,0.2875210167181073,-1.4472763531061303,0.905617238681307,-1.212092467279615,-0.4059577651591038,-0.049353199427741926,-0.10718085793039525,1.3154673388256952,-0.3416899315074888,-0.9635711742203847,0.744338965743411,-0.5601326434471046,-0.9772813005967932,-0.4142720048246363,-1.2072930734276848,-0.0637472401829505,0.27508685497813434,-1.7532303900463644,-0.2711244689023833,-0.24752626984568707,-0.6585869885045919,-1.7904630892032412,1.3439583157006354,-0.40420078707498047,-0.3861649633979502,-0.23315866838582855,-0.517952334405128,-0.10253396614652134,-1.7252605432461694,0.508346913429699,-0.9851173243444596,1.4199922057927348,0.19944110921438213,-0.21506296073840564,0.491881335376552,-0.49924124683133264,0.5179475743383115,-1.3443455646151428,0.8394078416222844,-0.939925609297033,0.8936502835922606,-1.235069102951214,-1.149969216938906,0.5641521792653462,-0.33828000109639506,-0.7008449814419991,1.1165355788996316,2.0874569503068896,-0.7842850416601074,-1.0236736911547528,0.6721748871909491,-1.341525889084005]\n", "}\n", "}]\n", "};\n", " var plotContainer = document.getElementById(\"yD1Z0H\");\n", " window.letsPlotCall(function() {{\n", " LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n", " }});\n", " })(); \n", " </script>" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "val p = letsPlot() + ggsize(600,200)\n", "\n", "val scatter = p + geomPoint(color=\"black\", alpha=.4) {x=xs; y=ys}\n", "scatter" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ " <div id=\"74yTDP\"></div>\n", " <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n", " (function() {\n", " var plotSpec={\n", "\"mapping\":{\n", "},\n", "\"ggsize\":{\n", "\"width\":600.0,\n", "\"height\":200.0\n", "},\n", "\"kind\":\"plot\",\n", "\"scales\":[],\n", "\"layers\":[{\n", "\"mapping\":{\n", "\"x\":\"x\"\n", "},\n", "\"stat\":\"bin\",\n", "\"position\":\"stack\",\n", "\"geom\":\"histogram\",\n", "\"fill\":\"dark_magenta\",\n", "\"data\":{\n", "\"..count..\":[1.0,0.0,0.0,1.0,1.0,1.0,3.0,3.0,3.0,10.0,12.0,20.0,25.0,43.0,37.0,29.0,33.0,41.0,27.0,29.0,19.0,19.0,20.0,10.0,5.0,5.0,2.0,0.0,0.0,1.0],\n", "\"x\":[-3.6174275534976683,-3.3909120392245398,-3.164396524951411,-2.9378810106782827,-2.711365496405154,-2.484849982132026,-2.258334467858897,-2.031818953585769,-1.8053034393126401,-1.5787879250395118,-1.3522724107663833,-1.1257568964932547,-0.8992413822201262,-0.6727258679469976,-0.4462103536738691,-0.21969483940074053,0.006820674872388022,0.23333618914551657,0.4598517034186447,0.6863672176917737,0.9128827319649018,1.1393982462380308,1.3659137605111589,1.5924292747842879,1.818944789057416,2.045460303330545,2.271975817603673,2.498491331876802,2.72500684614993,2.951522360423059]\n", "}\n", "}]\n", "};\n", " var plotContainer = document.getElementById(\"74yTDP\");\n", " window.letsPlotCall(function() {{\n", " LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n", " }});\n", " })(); \n", " </script>" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "val histogram = p + geomHistogram(fill=\"dark_magenta\") {x=xs}\n", "histogram" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Combine both plots in one figure" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ " <div id=\"ZaW4UR\"></div>\n", " <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n", " (function() {\n", " var plotSpec={\n", "\"kind\":\"ggbunch\",\n", "\"items\":[{\n", "\"x\":0,\n", "\"width\":null,\n", "\"y\":0,\n", "\"feature_spec\":{\n", "\"layers\":[{\n", "\"mapping\":{\n", "\"x\":\"x\"\n", "},\n", "\"stat\":\"bin\",\n", "\"position\":\"stack\",\n", "\"geom\":\"histogram\",\n", "\"fill\":\"dark_magenta\",\n", "\"data\":{\n", "\"..count..\":[0.0,0.0,1.0,1.0,0.0,3.0,3.0,4.0,10.0,12.0,26.0,30.0,41.0,33.0,40.0,41.0,35.0,29.0,21.0,25.0,21.0,10.0,6.0,4.0,2.0,0.0,1.0,0.0,0.0,0.0],\n", "\"x\":[-3.541222222222222,-3.2969999999999997,-3.0527777777777776,-2.8085555555555555,-2.564333333333333,-2.320111111111111,-2.0758888888888887,-1.8316666666666663,-1.5874444444444442,-1.3432222222222219,-1.0989999999999998,-0.8547777777777776,-0.6105555555555555,-0.3663333333333334,-0.12211111111111084,0.12211111111111128,0.3663333333333334,0.6105555555555555,0.8547777777777781,1.0989999999999998,1.3432222222222223,1.587444444444444,1.8316666666666666,2.075888888888889,2.320111111111111,2.5643333333333334,2.808555555555555,3.0527777777777776,3.297,3.541222222222222]\n", "}\n", "}],\n", "\"mapping\":{\n", "},\n", "\"ggsize\":{\n", "\"width\":600.0,\n", "\"height\":200.0\n", "},\n", "\"kind\":\"plot\",\n", "\"scales\":[{\n", "\"aesthetic\":\"x\",\n", "\"limits\":[-3.5,3.5]\n", "}]\n", "},\n", "\"height\":null\n", "},{\n", "\"x\":0,\n", "\"width\":null,\n", "\"y\":200,\n", "\"feature_spec\":{\n", "\"layers\":[{\n", "\"mapping\":{\n", "\"x\":\"x\",\n", "\"y\":\"y\"\n", "},\n", "\"stat\":\"identity\",\n", "\"color\":\"black\",\n", "\"alpha\":0.4,\n", "\"position\":\"identity\",\n", "\"geom\":\"point\",\n", "\"data\":{\n", "\"x\":[-0.6744640199025198,1.1688609933155418,-0.7798635003683787,-1.0575765850104435,-0.21133517484449102,-0.43703695115361535,-1.164777495612634,-0.5814437773139531,1.4325041796167088,1.2263820001713754,1.1286164161324417,-0.22825957758128768,-0.4004713771601831,0.6664538499624992,-0.10279704526589616,-0.6718952577246665,0.11606385517388161,-2.158497089938217,0.32729536035251305,0.8410159607062793,-0.46849691977181085,-0.4109888165401843,-0.1859037174307802,0.17509272671447068,-0.415285336588659,-0.23822814898234984,0.8038433766389336,-0.5346942523026389,0.07625398874397708,-0.5820054223326827,-0.6455726139124609,0.5904200735386678,-2.2088222612659965,0.282563605446129,0.2456626168541644,-0.12972861958357146,1.9362386971988845,1.007454364566747,0.27505632953838816,1.67458063198,0.7911157220043826,-1.095892638267239,-1.1063779379551584,-0.1393810695701042,2.913288850052117,0.6904564793847627,0.7400690642955501,-0.46959889661032184,1.341406123781579,0.30664512125115884,-1.3263569627601735,1.038231141062499,-1.5174427563160675,0.6864031278524461,-0.7454420605309788,1.992713666493837,0.5593647083868054,0.45130115874528715,1.5425685716647353,-0.9605146246361498,-0.08523419271875438,1.111435961359105,-0.8524110466531205,0.1614934389407704,0.1571394859285564,1.067315278685693,0.621806599851275,1.5493862830807028,-1.1336113094003275,1.442415378514537,-0.6961723889302749,0.12197337141661355,-0.28392754338046744,-0.7038151371673095,-0.6878249924054599,0.6976187437879244,0.6273765488641239,-0.3993781932341655,-0.15560729174098611,-0.2806713570403014,0.5013085190606195,0.6106377354016977,-0.4893869942232398,1.9801775390874534,0.5741506800233674,-0.6724596427198881,-0.47822448541630436,0.27202580262527665,1.4280074398490983,1.0605876647876462,0.009427070708191973,0.3046331171047675,-0.5240961069893961,0.9141556511392445,2.0146839535666983,0.6579552852739827,0.3620035267256028,-0.6155136694769258,-1.3059734083292327,1.1804347811503173,-0.00878255187277409,-0.4855523693255114,-0.4268632688904139,1.3740850493928483,-0.5759900916662539,-0.3641767940830528,-0.6872737505724394,-0.6204913005009245,-1.062716561716572,1.0441178467310759,1.0574628436773703,0.2749536947264239,-0.05564571090795107,0.5898848385633713,-1.2574405331080798,-0.343856678542779,1.7727854698384218,0.44062598938709463,0.052173725141496353,-1.3419897472693638,-1.2485293393451584,-0.9858255966527361,-0.14233376465120176,-0.8906901957309995,0.1290914034077799,-1.2441492311975322,0.8606772012240371,-0.5732537081333599,-0.4747454050196354,-1.2777245800353252,0.6650410527153144,0.2736966295543624,0.275793362642477,1.2615129908036915,1.0741155929716693,0.07846385544461255,-0.38214793847042927,-0.4255912480644681,0.7930608875535996,-2.106753628258502,0.5475489356145378,0.4368452462753567,1.0161221301289975,-0.5632332300060781,-1.8477430614769195,-1.0472677511269095,-0.3542092544313052,-0.6163504115919833,-1.4453216467453514,-0.7544764199230152,0.35459637023800367,-1.5081932379179162,-1.6508922833016837,1.5797471495564652,-0.3090123656408648,-1.928443006525644,0.12391837091500493,1.2967316779965619,-0.7251034228383786,-0.0865116533475522,0.13270334003362758,-0.7070680026276068,-0.338809191616442,0.51292942969293,0.8850030193216443,-1.6038464582240335,-0.06380557043187186,1.3505934493395373,-1.1670499785467299,-0.05152331263614816,0.5785698151327001,0.14613622968091022,0.4421517291901596,0.9588054111507096,1.3711321535645093,0.23394531985372047,1.7482867092568144,-0.4252669320927708,0.8418949362763407,0.3551069063529994,1.0527696876422186,-0.6520396236217345,-0.22885246721890842,1.2840084983090168,-0.6881940466475199,0.16874703734057184,1.2727230364194406,0.36642299951376406,-0.6867301957900299,0.992305214707094,-0.20765586720306084,-0.5502492039908247,1.325219003277658,-2.2021464492971665,1.0054470224123828,-1.5772445879240753,-0.6078661269222209,-0.9048779353319325,-0.18187790309928129,-1.6172087565802113,-0.5463903345650736,-0.7703380148862496,0.3663034267556162,-0.6316812822572508,0.3080504688778069,-0.1908768968623617,-2.6963049137652613,0.10986883745211973,-1.0798596306307144,1.810514927017933,-0.6228312468938239,-0.2608657864505899,-0.13150365935394379,-0.467972547001626,1.797985242671896,0.1154289011371147,0.1595548347155912,-0.07393776081132851,0.5307735884849949,-1.022859114386942,-0.39298290799971497,0.7775511666560517,1.3725783778787235,-0.6289832768725503,-0.3961713261491232,-0.7141265366397814,1.9303813648030068,1.635166941821612,-0.5288559606592628,0.3823916781127417,-0.7867284817392186,-0.7514353671687319,0.42227776027954034,1.164734665795169,0.07448332065658074,-0.9513944136215156,0.15551831890151738,-1.2419776616947893,-0.19315370692280487,0.06301873859514497,-0.6683036338964441,-0.9810018132858906,-0.9984894495575073,-1.4858876828970087,1.023863492449694,-0.10755987494996634,0.41569482181237405,-0.22883460527361998,0.1853587129128223,0.7839560148234038,-0.5467427014709897,-1.338671276709058,0.318195841624596,1.4578434658924702,-0.2157935114973045,0.7901579860854885,0.008154189031804027,-0.7892662415596127,1.565774609411783,-0.7728112585429747,0.4813685943054223,-0.03555637763560912,-1.9570883274099817,0.3412855912215129,-0.2964533867494741,-1.3183553555323142,-1.1065204582306896,-0.18697235266440285,0.2210624987814711,-0.46804694996823515,-0.8709796665110143,-0.7491536758306041,-0.7373377424027923,1.3109038321853528,0.9242882106369306,1.1769784833105585,0.9548491991754234,1.0350417408583006,0.4240043021497952,-1.2509812748213214,-1.000617204015416,0.36864841621115024,0.33260744760968275,-1.206560499939688,0.6822030185642028,0.4729761182738336,0.4544524343009744,-0.35197522169199064,-0.11721057304590095,0.7016903092926798,1.0849161816518795,-0.7817242054666317,-0.7349145187158622,0.0063144856188233085,1.11192020239858,0.546813574410527,-0.8565734065917627,1.010644425113122,-0.3636820014661913,-1.1185560996978599,0.0681672427771298,-0.14090146398569794,1.5296031000730816,2.3639753311004954,0.49750518072204564,-1.012076584977165,0.586548738845585,-0.04060150187383195,1.093236677861897,-0.2189874966792859,-1.8543973631932458,-0.4918628070728557,0.23744916194094381,-0.0011216629891699754,-1.0633039037442018,0.8605154110028084,-0.024949637789862804,-1.1527172478944787,1.4640949689936218,-0.3648134482878574,-0.8490796069267117,0.058402753362986656,-0.44458011129741143,0.7428634562657651,-1.8210667548223796,0.3765034605130482,-0.8338884659358015,0.16728454677695495,-2.3764310421139307,-0.7816594611764757,1.3298731271168391,1.4290880297252289,-1.0451312953919853,-0.7922692863469232,0.261180836448762,0.8086315833784016,-0.9062271305897804,-0.7991779130868759,0.03404238715302243,0.2502286566601771,1.4967743097931494,0.23731823410810535,-1.0002542736029052,-0.6314434285522788,-0.03692412288482845,1.014056561922927,1.487643646810606,0.049615710675105736,-1.1145834188054784,0.7075326072412758,0.2712816584999319,-1.141908031042825,-0.9014366910920025,-0.09065973343509498,0.5082448338268991,-0.5599985658526059,0.5195560173676982,-0.9756539857667424,-0.3854980643799661,0.17324099945895904,2.0736451959971127,-1.4815292264732338,-0.5896044898970765,0.06952546624886935,0.1397733360451365,-0.6915365754281684,1.611269862564514,-0.7933328463910049,-0.5281587635918719,-0.6035286100309599,-0.9477183417341062,0.15498445359372398,-2.9880191108687817,-0.14845508081967465,-3.579194043126726,0.20764044930214787,0.2051333495616271,0.757197148229616,-0.8222884943170924,-0.2378240500504717,0.17179296925937573,0.8732075014438977,0.2147610851018894,0.7027551944543391,1.1095994434030567,-0.3876001734446714,-0.020310634441371968,0.674927289513476,-1.0355101392496213,2.2239167947252447,-1.0907579889739671,1.2864383960299692,0.794428024789826,0.5893058325723117,-0.08748679403195728,0.08993060728462124,-1.5811792996355263,1.2981338651688155,-0.1704016716225429,-1.6895124979602294],\n", "\"y\":[0.6661602010520571,1.270394779913487,-0.8057208237718527,1.735820325391944,0.7868455065432844,-0.17093352852816965,0.3447412143680761,-0.49870439796579213,1.9348226702746807,0.39668241487834416,1.2116230775512813,-0.5220070116369592,-0.925076710867466,0.8072362025186218,-0.40061881919633885,0.511028340092403,0.13725152337277255,-0.09419033560427485,0.8041814042307718,0.01967303568025677,-1.6015338416178044,0.5951910558078379,1.6806096679236213,0.7457129888784676,-2.0789763467307343,0.3412101846751085,0.11924010124190376,-1.1863467396888525,-0.15383189854418122,-0.4821865099703338,1.7467482414242215,-0.7006607639026755,-0.34773525036210706,-0.4151204967957861,-1.5032148285874696,-0.12529183593225476,0.6156337854767402,1.0993629219449024,-0.349634295623502,-0.6212616861123954,-1.419792938577749,-0.9717833353615182,-0.7069155215573859,-0.9496910845617567,-0.7867901733075993,0.511476561814012,0.41299416522189775,2.2576077474543155,0.04756504701604761,0.33630290766523036,-0.395634525321286,-0.2558607499857383,0.5413422961354568,1.3835682423938225,-0.6026172641494515,-0.21712271701580865,-0.6462257030121765,1.277547764420519,-1.1031886378891851E-4,0.7020194229609626,1.680110170634347,-0.7129559114154423,1.3124638577922958,0.6999069837652357,0.3687801010518353,0.48729408960506676,-1.9498325722776035,-0.41641852914490574,-1.5976165972731982,0.45300127300211934,-1.2458556398607952,0.5017029853261534,1.8652006385209974,0.5436923988427741,-0.9236901757070967,0.3890025423371501,-0.7499049670498529,0.7838730219418087,-1.6063029389504475,-0.008658674674104977,1.663716507212271,1.6852412396190222,0.6399942740853949,0.6805644526009091,0.3263252455603378,1.5360904505222914,-1.0308623290749828,-1.0590248837209169,0.7398169628587751,-1.9786633987987332,-0.48265117841086447,-0.3853938776245876,-0.2809202928613043,-0.16796591386658746,-1.2304759777310212,-1.109631165439823,-0.5773037006302898,1.3331144497076641,0.7503244906768306,0.4497678141094829,0.13607615677095608,-0.30423007635962607,0.07667780159047334,0.2539128195449736,0.28501837938448643,0.09700451749730972,-0.08220749654206347,-0.02659997793193712,-1.335049448682979,1.6929469381377789,0.3944413449819634,-1.2339544251330405,-0.2031091321032242,0.2469771245493247,-0.28499819749338784,0.367271636780082,-2.615485846927002,-0.17690338009758377,0.007401587665870942,0.8641096838523415,-0.24689236579662807,-0.04804891978589835,-1.4308661512054395,-0.31489533804846837,0.43597562169899956,-0.7834052471459008,-0.49494788373426246,0.10644118295037602,0.5888137968689542,2.266262715631338,0.29603195381193637,0.326015946425065,-1.3660486658948519,-0.9592409430165723,-0.0630237756444974,0.6985736113148365,0.8458839805024344,0.5152976969300707,-0.6042580318342613,-0.13261633603649114,-0.2877378427982844,0.33960954882708644,0.7513732025416191,-0.5407966984690689,1.1679653401843288,0.884312993997179,0.308535147323782,0.967351137961291,-0.4402244474693009,-1.0569358530671753,-0.07364049457009965,-1.294621789773702,1.0710564893126344,-0.9084820367832598,0.08135082296317361,0.11129637116824853,-1.0015276728748064,-2.4892824949118677,0.6045616863159997,-0.5935785984022471,0.501178731855949,0.8431846973874959,-0.34141204628342364,1.5600067687761343,1.28758871105485,1.461279487669829,-1.4994310598294114,0.2798786555448607,1.4061847172023074,-0.07224883348822239,-0.4104103269454383,0.49523688957468204,1.8351561198228457,-0.1639552903024566,1.4246619833172218,-0.685011120624986,0.273265833584567,-0.21924761496406908,-0.5035957928945841,0.6530931731693584,0.4750839038354609,-2.0274325134252034,-1.9065469128556307,1.2188414280921194,0.34362606643444693,-0.1526572696321081,-0.4698200482154767,0.4134218214559642,0.4252579808462775,-0.7321593578082719,-0.43525739769038074,-0.48625782977803605,-2.083035343824787,0.14384991642746636,-1.6529338266994753,-0.6350114758611285,-1.6681439164808158,-2.2276915053720994,0.1363831230758303,1.6163616972799912,-0.7459164843393543,2.1067030970715397,-0.17470801001639483,0.9910087384434383,-0.6814246302856187,0.3515225936187945,0.5640234935829792,-0.6740818463433754,-0.3935337290451268,-0.2393325269969546,0.24565191576507442,-0.5497986267759223,-0.13272532421753688,0.18605623512050912,1.5996079500350842,-0.3232125316252129,0.368077265338442,-1.2878746752950607,-0.029924290341881925,0.46483519582236765,0.21136854600086577,0.6603102954286026,-0.823471511909781,-0.08041298890549176,0.8644282304924725,-0.26616366911946066,-1.5566551664873147,0.4286117014945917,-0.6533287966519005,0.48835395302773776,1.6009930949035922,0.0631512638825802,-0.7415863591777397,0.47264996113012875,-0.9451334535711523,0.5295458199064564,-0.814412342292681,-0.8443886659659555,-1.8182723279942894,0.6687683849585785,-0.22905112746593675,-0.062242134943014234,1.5318333731381506,1.1946830035154299,-0.364361633199291,-0.9883269899587411,-1.031772402899363,-1.6418495968573268,0.8328566651733088,-0.57751062549269,-1.6900832557944294,1.6678024876651931,-0.7120529334191709,0.5861777009912414,-0.18733380973234726,0.621700061233281,-0.6716112883678875,-1.6563930622412077,-1.876144320075645,-1.457109956054859,0.2419744211596227,-1.1005627519199772,1.1039546818963242,2.6997786595999957,-0.3620843714884368,1.55354842399825,0.5972181692598149,0.44283010806347967,-1.4680658662958304,-2.267316249485942,-1.0487421799045624,-0.018596681165419023,-0.8001970740422907,-1.406450107673903,-0.5509049056739228,0.6754627588178578,-0.06884619560386458,-0.42782431758530143,1.2213749520812753,-1.5902454518427525,-0.844842017372366,1.8877488199738104,1.7017554253461908,0.5246189289944397,-0.9287646730712531,-1.4517564224839037,0.5122933201712003,-0.19647652499600554,-0.7417421487177752,-1.2163309507935638,0.2880900728298288,-1.7780969866913972,-0.5805496197755603,-0.3800594716663436,-1.3112561573749872,-1.2373128133396845,-0.09456367364942278,-0.7245060018671905,1.971038301776271,1.1220550741127149,0.04202960869284377,0.011016378533954742,-1.3713917193129093,-0.7614790341645236,0.20864574248058737,-1.6797548037073005,-0.27943214388735954,0.845984890866596,-0.32354589715107107,-0.16646427590890103,1.12420618678173,-0.8111943161922545,-0.5580894017246969,-0.43189136749197027,-0.20865026057767122,0.5080631258988317,0.12486086720026708,0.17917070373765018,0.002132960571923035,0.5878865536896458,0.16979301793813076,-0.16138332018055732,-0.5539608098814934,0.4020107395019965,-1.3356990444959138,-0.22929716389461488,-0.016639210193379956,0.17449713411670062,-0.34002052123609006,-1.0242903068489628,0.7661025666586033,0.43135537241935323,0.3830984050562818,0.029341773251223342,-0.9524355819861764,-1.8487919864514415,-0.5333783323331674,-1.310297183757364,-1.962779314560478,-0.29586294472753555,1.2601905199713175,0.2258623335479983,1.164028842034106,1.2601762485889645,-1.6198229221332971,-0.19940094653650764,0.9351061044738597,-0.8723662733450582,0.2875210167181073,-1.4472763531061303,0.905617238681307,-1.212092467279615,-0.4059577651591038,-0.049353199427741926,-0.10718085793039525,1.3154673388256952,-0.3416899315074888,-0.9635711742203847,0.744338965743411,-0.5601326434471046,-0.9772813005967932,-0.4142720048246363,-1.2072930734276848,-0.0637472401829505,0.27508685497813434,-1.7532303900463644,-0.2711244689023833,-0.24752626984568707,-0.6585869885045919,-1.7904630892032412,1.3439583157006354,-0.40420078707498047,-0.3861649633979502,-0.23315866838582855,-0.517952334405128,-0.10253396614652134,-1.7252605432461694,0.508346913429699,-0.9851173243444596,1.4199922057927348,0.19944110921438213,-0.21506296073840564,0.491881335376552,-0.49924124683133264,0.5179475743383115,-1.3443455646151428,0.8394078416222844,-0.939925609297033,0.8936502835922606,-1.235069102951214,-1.149969216938906,0.5641521792653462,-0.33828000109639506,-0.7008449814419991,1.1165355788996316,2.0874569503068896,-0.7842850416601074,-1.0236736911547528,0.6721748871909491,-1.341525889084005]\n", "}\n", "}],\n", "\"mapping\":{\n", "},\n", "\"ggsize\":{\n", "\"width\":600.0,\n", "\"height\":200.0\n", "},\n", "\"kind\":\"plot\",\n", "\"scales\":[{\n", "\"aesthetic\":\"x\",\n", "\"limits\":[-3.5,3.5]\n", "}]\n", "},\n", "\"height\":null\n", "}]\n", "};\n", " var plotContainer = document.getElementById(\"ZaW4UR\");\n", " window.letsPlotCall(function() {{\n", " LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n", " }});\n", " })(); \n", " </script>" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "// Set scale X limits manually because of computed automatically\n", "// the scale used by each plot would be slightly different\n", "// and the stacked plots wouldn't be aligned.\n", "val scale_x = scaleXContinuous(limits=-3.5 to 3.5)\n", "GGBunch().addPlot(histogram + scale_x, 0, 0)\n", " .addPlot(scatter + scale_x, 0, 200)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Adjust visuals of the bunch figure" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "val upper_theme = theme(axis=\"blank\", axisText=elementText(), axisTitleY=elementText(), panelGridMajorY=\"blank\")\n", "val lower_theme = theme(axis=\"blank\", axisTextY=elementText(), axisTitle=elementText())" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/html": [ " <div id=\"Ipey6j\"></div>\n", " <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n", " (function() {\n", " var plotSpec={\n", "\"kind\":\"ggbunch\",\n", "\"items\":[{\n", "\"x\":0,\n", "\"width\":null,\n", "\"y\":0,\n", "\"feature_spec\":{\n", "\"mapping\":{\n", "},\n", "\"ggsize\":{\n", "\"width\":600.0,\n", "\"height\":200.0\n", "},\n", "\"kind\":\"plot\",\n", "\"scales\":[{\n", "\"aesthetic\":\"x\",\n", "\"limits\":[-3.5,3.5]\n", "}],\n", "\"layers\":[{\n", "\"mapping\":{\n", "\"x\":\"x\"\n", "},\n", "\"stat\":\"bin\",\n", "\"position\":\"stack\",\n", "\"geom\":\"histogram\",\n", "\"fill\":\"dark_magenta\",\n", "\"data\":{\n", "\"..count..\":[0.0,0.0,1.0,1.0,0.0,3.0,3.0,4.0,10.0,12.0,26.0,30.0,41.0,33.0,40.0,41.0,35.0,29.0,21.0,25.0,21.0,10.0,6.0,4.0,2.0,0.0,1.0,0.0,0.0,0.0],\n", "\"x\":[-3.541222222222222,-3.2969999999999997,-3.0527777777777776,-2.8085555555555555,-2.564333333333333,-2.320111111111111,-2.0758888888888887,-1.8316666666666663,-1.5874444444444442,-1.3432222222222219,-1.0989999999999998,-0.8547777777777776,-0.6105555555555555,-0.3663333333333334,-0.12211111111111084,0.12211111111111128,0.3663333333333334,0.6105555555555555,0.8547777777777781,1.0989999999999998,1.3432222222222223,1.587444444444444,1.8316666666666666,2.075888888888889,2.320111111111111,2.5643333333333334,2.808555555555555,3.0527777777777776,3.297,3.541222222222222]\n", "}\n", "}],\n", "\"theme\":{\n", "\"axis_title_y\":{\n", "\"blank\":false\n", "},\n", "\"axis\":\"blank\",\n", "\"axis_text\":{\n", "\"blank\":false\n", "},\n", "\"panel_grid_major_y\":\"blank\"\n", "}\n", "},\n", "\"height\":null\n", "},{\n", "\"x\":0,\n", "\"width\":null,\n", "\"y\":200,\n", "\"feature_spec\":{\n", "\"mapping\":{\n", "},\n", "\"ggsize\":{\n", "\"width\":600.0,\n", "\"height\":200.0\n", "},\n", "\"kind\":\"plot\",\n", "\"scales\":[{\n", "\"aesthetic\":\"x\",\n", "\"limits\":[-3.5,3.5]\n", "}],\n", "\"layers\":[{\n", "\"mapping\":{\n", "\"x\":\"x\",\n", "\"y\":\"y\"\n", "},\n", "\"stat\":\"identity\",\n", "\"color\":\"black\",\n", "\"alpha\":0.4,\n", "\"position\":\"identity\",\n", "\"geom\":\"point\",\n", "\"data\":{\n", "\"x\":[-0.6744640199025198,1.1688609933155418,-0.7798635003683787,-1.0575765850104435,-0.21133517484449102,-0.43703695115361535,-1.164777495612634,-0.5814437773139531,1.4325041796167088,1.2263820001713754,1.1286164161324417,-0.22825957758128768,-0.4004713771601831,0.6664538499624992,-0.10279704526589616,-0.6718952577246665,0.11606385517388161,-2.158497089938217,0.32729536035251305,0.8410159607062793,-0.46849691977181085,-0.4109888165401843,-0.1859037174307802,0.17509272671447068,-0.415285336588659,-0.23822814898234984,0.8038433766389336,-0.5346942523026389,0.07625398874397708,-0.5820054223326827,-0.6455726139124609,0.5904200735386678,-2.2088222612659965,0.282563605446129,0.2456626168541644,-0.12972861958357146,1.9362386971988845,1.007454364566747,0.27505632953838816,1.67458063198,0.7911157220043826,-1.095892638267239,-1.1063779379551584,-0.1393810695701042,2.913288850052117,0.6904564793847627,0.7400690642955501,-0.46959889661032184,1.341406123781579,0.30664512125115884,-1.3263569627601735,1.038231141062499,-1.5174427563160675,0.6864031278524461,-0.7454420605309788,1.992713666493837,0.5593647083868054,0.45130115874528715,1.5425685716647353,-0.9605146246361498,-0.08523419271875438,1.111435961359105,-0.8524110466531205,0.1614934389407704,0.1571394859285564,1.067315278685693,0.621806599851275,1.5493862830807028,-1.1336113094003275,1.442415378514537,-0.6961723889302749,0.12197337141661355,-0.28392754338046744,-0.7038151371673095,-0.6878249924054599,0.6976187437879244,0.6273765488641239,-0.3993781932341655,-0.15560729174098611,-0.2806713570403014,0.5013085190606195,0.6106377354016977,-0.4893869942232398,1.9801775390874534,0.5741506800233674,-0.6724596427198881,-0.47822448541630436,0.27202580262527665,1.4280074398490983,1.0605876647876462,0.009427070708191973,0.3046331171047675,-0.5240961069893961,0.9141556511392445,2.0146839535666983,0.6579552852739827,0.3620035267256028,-0.6155136694769258,-1.3059734083292327,1.1804347811503173,-0.00878255187277409,-0.4855523693255114,-0.4268632688904139,1.3740850493928483,-0.5759900916662539,-0.3641767940830528,-0.6872737505724394,-0.6204913005009245,-1.062716561716572,1.0441178467310759,1.0574628436773703,0.2749536947264239,-0.05564571090795107,0.5898848385633713,-1.2574405331080798,-0.343856678542779,1.7727854698384218,0.44062598938709463,0.052173725141496353,-1.3419897472693638,-1.2485293393451584,-0.9858255966527361,-0.14233376465120176,-0.8906901957309995,0.1290914034077799,-1.2441492311975322,0.8606772012240371,-0.5732537081333599,-0.4747454050196354,-1.2777245800353252,0.6650410527153144,0.2736966295543624,0.275793362642477,1.2615129908036915,1.0741155929716693,0.07846385544461255,-0.38214793847042927,-0.4255912480644681,0.7930608875535996,-2.106753628258502,0.5475489356145378,0.4368452462753567,1.0161221301289975,-0.5632332300060781,-1.8477430614769195,-1.0472677511269095,-0.3542092544313052,-0.6163504115919833,-1.4453216467453514,-0.7544764199230152,0.35459637023800367,-1.5081932379179162,-1.6508922833016837,1.5797471495564652,-0.3090123656408648,-1.928443006525644,0.12391837091500493,1.2967316779965619,-0.7251034228383786,-0.0865116533475522,0.13270334003362758,-0.7070680026276068,-0.338809191616442,0.51292942969293,0.8850030193216443,-1.6038464582240335,-0.06380557043187186,1.3505934493395373,-1.1670499785467299,-0.05152331263614816,0.5785698151327001,0.14613622968091022,0.4421517291901596,0.9588054111507096,1.3711321535645093,0.23394531985372047,1.7482867092568144,-0.4252669320927708,0.8418949362763407,0.3551069063529994,1.0527696876422186,-0.6520396236217345,-0.22885246721890842,1.2840084983090168,-0.6881940466475199,0.16874703734057184,1.2727230364194406,0.36642299951376406,-0.6867301957900299,0.992305214707094,-0.20765586720306084,-0.5502492039908247,1.325219003277658,-2.2021464492971665,1.0054470224123828,-1.5772445879240753,-0.6078661269222209,-0.9048779353319325,-0.18187790309928129,-1.6172087565802113,-0.5463903345650736,-0.7703380148862496,0.3663034267556162,-0.6316812822572508,0.3080504688778069,-0.1908768968623617,-2.6963049137652613,0.10986883745211973,-1.0798596306307144,1.810514927017933,-0.6228312468938239,-0.2608657864505899,-0.13150365935394379,-0.467972547001626,1.797985242671896,0.1154289011371147,0.1595548347155912,-0.07393776081132851,0.5307735884849949,-1.022859114386942,-0.39298290799971497,0.7775511666560517,1.3725783778787235,-0.6289832768725503,-0.3961713261491232,-0.7141265366397814,1.9303813648030068,1.635166941821612,-0.5288559606592628,0.3823916781127417,-0.7867284817392186,-0.7514353671687319,0.42227776027954034,1.164734665795169,0.07448332065658074,-0.9513944136215156,0.15551831890151738,-1.2419776616947893,-0.19315370692280487,0.06301873859514497,-0.6683036338964441,-0.9810018132858906,-0.9984894495575073,-1.4858876828970087,1.023863492449694,-0.10755987494996634,0.41569482181237405,-0.22883460527361998,0.1853587129128223,0.7839560148234038,-0.5467427014709897,-1.338671276709058,0.318195841624596,1.4578434658924702,-0.2157935114973045,0.7901579860854885,0.008154189031804027,-0.7892662415596127,1.565774609411783,-0.7728112585429747,0.4813685943054223,-0.03555637763560912,-1.9570883274099817,0.3412855912215129,-0.2964533867494741,-1.3183553555323142,-1.1065204582306896,-0.18697235266440285,0.2210624987814711,-0.46804694996823515,-0.8709796665110143,-0.7491536758306041,-0.7373377424027923,1.3109038321853528,0.9242882106369306,1.1769784833105585,0.9548491991754234,1.0350417408583006,0.4240043021497952,-1.2509812748213214,-1.000617204015416,0.36864841621115024,0.33260744760968275,-1.206560499939688,0.6822030185642028,0.4729761182738336,0.4544524343009744,-0.35197522169199064,-0.11721057304590095,0.7016903092926798,1.0849161816518795,-0.7817242054666317,-0.7349145187158622,0.0063144856188233085,1.11192020239858,0.546813574410527,-0.8565734065917627,1.010644425113122,-0.3636820014661913,-1.1185560996978599,0.0681672427771298,-0.14090146398569794,1.5296031000730816,2.3639753311004954,0.49750518072204564,-1.012076584977165,0.586548738845585,-0.04060150187383195,1.093236677861897,-0.2189874966792859,-1.8543973631932458,-0.4918628070728557,0.23744916194094381,-0.0011216629891699754,-1.0633039037442018,0.8605154110028084,-0.024949637789862804,-1.1527172478944787,1.4640949689936218,-0.3648134482878574,-0.8490796069267117,0.058402753362986656,-0.44458011129741143,0.7428634562657651,-1.8210667548223796,0.3765034605130482,-0.8338884659358015,0.16728454677695495,-2.3764310421139307,-0.7816594611764757,1.3298731271168391,1.4290880297252289,-1.0451312953919853,-0.7922692863469232,0.261180836448762,0.8086315833784016,-0.9062271305897804,-0.7991779130868759,0.03404238715302243,0.2502286566601771,1.4967743097931494,0.23731823410810535,-1.0002542736029052,-0.6314434285522788,-0.03692412288482845,1.014056561922927,1.487643646810606,0.049615710675105736,-1.1145834188054784,0.7075326072412758,0.2712816584999319,-1.141908031042825,-0.9014366910920025,-0.09065973343509498,0.5082448338268991,-0.5599985658526059,0.5195560173676982,-0.9756539857667424,-0.3854980643799661,0.17324099945895904,2.0736451959971127,-1.4815292264732338,-0.5896044898970765,0.06952546624886935,0.1397733360451365,-0.6915365754281684,1.611269862564514,-0.7933328463910049,-0.5281587635918719,-0.6035286100309599,-0.9477183417341062,0.15498445359372398,-2.9880191108687817,-0.14845508081967465,-3.579194043126726,0.20764044930214787,0.2051333495616271,0.757197148229616,-0.8222884943170924,-0.2378240500504717,0.17179296925937573,0.8732075014438977,0.2147610851018894,0.7027551944543391,1.1095994434030567,-0.3876001734446714,-0.020310634441371968,0.674927289513476,-1.0355101392496213,2.2239167947252447,-1.0907579889739671,1.2864383960299692,0.794428024789826,0.5893058325723117,-0.08748679403195728,0.08993060728462124,-1.5811792996355263,1.2981338651688155,-0.1704016716225429,-1.6895124979602294],\n", "\"y\":[0.6661602010520571,1.270394779913487,-0.8057208237718527,1.735820325391944,0.7868455065432844,-0.17093352852816965,0.3447412143680761,-0.49870439796579213,1.9348226702746807,0.39668241487834416,1.2116230775512813,-0.5220070116369592,-0.925076710867466,0.8072362025186218,-0.40061881919633885,0.511028340092403,0.13725152337277255,-0.09419033560427485,0.8041814042307718,0.01967303568025677,-1.6015338416178044,0.5951910558078379,1.6806096679236213,0.7457129888784676,-2.0789763467307343,0.3412101846751085,0.11924010124190376,-1.1863467396888525,-0.15383189854418122,-0.4821865099703338,1.7467482414242215,-0.7006607639026755,-0.34773525036210706,-0.4151204967957861,-1.5032148285874696,-0.12529183593225476,0.6156337854767402,1.0993629219449024,-0.349634295623502,-0.6212616861123954,-1.419792938577749,-0.9717833353615182,-0.7069155215573859,-0.9496910845617567,-0.7867901733075993,0.511476561814012,0.41299416522189775,2.2576077474543155,0.04756504701604761,0.33630290766523036,-0.395634525321286,-0.2558607499857383,0.5413422961354568,1.3835682423938225,-0.6026172641494515,-0.21712271701580865,-0.6462257030121765,1.277547764420519,-1.1031886378891851E-4,0.7020194229609626,1.680110170634347,-0.7129559114154423,1.3124638577922958,0.6999069837652357,0.3687801010518353,0.48729408960506676,-1.9498325722776035,-0.41641852914490574,-1.5976165972731982,0.45300127300211934,-1.2458556398607952,0.5017029853261534,1.8652006385209974,0.5436923988427741,-0.9236901757070967,0.3890025423371501,-0.7499049670498529,0.7838730219418087,-1.6063029389504475,-0.008658674674104977,1.663716507212271,1.6852412396190222,0.6399942740853949,0.6805644526009091,0.3263252455603378,1.5360904505222914,-1.0308623290749828,-1.0590248837209169,0.7398169628587751,-1.9786633987987332,-0.48265117841086447,-0.3853938776245876,-0.2809202928613043,-0.16796591386658746,-1.2304759777310212,-1.109631165439823,-0.5773037006302898,1.3331144497076641,0.7503244906768306,0.4497678141094829,0.13607615677095608,-0.30423007635962607,0.07667780159047334,0.2539128195449736,0.28501837938448643,0.09700451749730972,-0.08220749654206347,-0.02659997793193712,-1.335049448682979,1.6929469381377789,0.3944413449819634,-1.2339544251330405,-0.2031091321032242,0.2469771245493247,-0.28499819749338784,0.367271636780082,-2.615485846927002,-0.17690338009758377,0.007401587665870942,0.8641096838523415,-0.24689236579662807,-0.04804891978589835,-1.4308661512054395,-0.31489533804846837,0.43597562169899956,-0.7834052471459008,-0.49494788373426246,0.10644118295037602,0.5888137968689542,2.266262715631338,0.29603195381193637,0.326015946425065,-1.3660486658948519,-0.9592409430165723,-0.0630237756444974,0.6985736113148365,0.8458839805024344,0.5152976969300707,-0.6042580318342613,-0.13261633603649114,-0.2877378427982844,0.33960954882708644,0.7513732025416191,-0.5407966984690689,1.1679653401843288,0.884312993997179,0.308535147323782,0.967351137961291,-0.4402244474693009,-1.0569358530671753,-0.07364049457009965,-1.294621789773702,1.0710564893126344,-0.9084820367832598,0.08135082296317361,0.11129637116824853,-1.0015276728748064,-2.4892824949118677,0.6045616863159997,-0.5935785984022471,0.501178731855949,0.8431846973874959,-0.34141204628342364,1.5600067687761343,1.28758871105485,1.461279487669829,-1.4994310598294114,0.2798786555448607,1.4061847172023074,-0.07224883348822239,-0.4104103269454383,0.49523688957468204,1.8351561198228457,-0.1639552903024566,1.4246619833172218,-0.685011120624986,0.273265833584567,-0.21924761496406908,-0.5035957928945841,0.6530931731693584,0.4750839038354609,-2.0274325134252034,-1.9065469128556307,1.2188414280921194,0.34362606643444693,-0.1526572696321081,-0.4698200482154767,0.4134218214559642,0.4252579808462775,-0.7321593578082719,-0.43525739769038074,-0.48625782977803605,-2.083035343824787,0.14384991642746636,-1.6529338266994753,-0.6350114758611285,-1.6681439164808158,-2.2276915053720994,0.1363831230758303,1.6163616972799912,-0.7459164843393543,2.1067030970715397,-0.17470801001639483,0.9910087384434383,-0.6814246302856187,0.3515225936187945,0.5640234935829792,-0.6740818463433754,-0.3935337290451268,-0.2393325269969546,0.24565191576507442,-0.5497986267759223,-0.13272532421753688,0.18605623512050912,1.5996079500350842,-0.3232125316252129,0.368077265338442,-1.2878746752950607,-0.029924290341881925,0.46483519582236765,0.21136854600086577,0.6603102954286026,-0.823471511909781,-0.08041298890549176,0.8644282304924725,-0.26616366911946066,-1.5566551664873147,0.4286117014945917,-0.6533287966519005,0.48835395302773776,1.6009930949035922,0.0631512638825802,-0.7415863591777397,0.47264996113012875,-0.9451334535711523,0.5295458199064564,-0.814412342292681,-0.8443886659659555,-1.8182723279942894,0.6687683849585785,-0.22905112746593675,-0.062242134943014234,1.5318333731381506,1.1946830035154299,-0.364361633199291,-0.9883269899587411,-1.031772402899363,-1.6418495968573268,0.8328566651733088,-0.57751062549269,-1.6900832557944294,1.6678024876651931,-0.7120529334191709,0.5861777009912414,-0.18733380973234726,0.621700061233281,-0.6716112883678875,-1.6563930622412077,-1.876144320075645,-1.457109956054859,0.2419744211596227,-1.1005627519199772,1.1039546818963242,2.6997786595999957,-0.3620843714884368,1.55354842399825,0.5972181692598149,0.44283010806347967,-1.4680658662958304,-2.267316249485942,-1.0487421799045624,-0.018596681165419023,-0.8001970740422907,-1.406450107673903,-0.5509049056739228,0.6754627588178578,-0.06884619560386458,-0.42782431758530143,1.2213749520812753,-1.5902454518427525,-0.844842017372366,1.8877488199738104,1.7017554253461908,0.5246189289944397,-0.9287646730712531,-1.4517564224839037,0.5122933201712003,-0.19647652499600554,-0.7417421487177752,-1.2163309507935638,0.2880900728298288,-1.7780969866913972,-0.5805496197755603,-0.3800594716663436,-1.3112561573749872,-1.2373128133396845,-0.09456367364942278,-0.7245060018671905,1.971038301776271,1.1220550741127149,0.04202960869284377,0.011016378533954742,-1.3713917193129093,-0.7614790341645236,0.20864574248058737,-1.6797548037073005,-0.27943214388735954,0.845984890866596,-0.32354589715107107,-0.16646427590890103,1.12420618678173,-0.8111943161922545,-0.5580894017246969,-0.43189136749197027,-0.20865026057767122,0.5080631258988317,0.12486086720026708,0.17917070373765018,0.002132960571923035,0.5878865536896458,0.16979301793813076,-0.16138332018055732,-0.5539608098814934,0.4020107395019965,-1.3356990444959138,-0.22929716389461488,-0.016639210193379956,0.17449713411670062,-0.34002052123609006,-1.0242903068489628,0.7661025666586033,0.43135537241935323,0.3830984050562818,0.029341773251223342,-0.9524355819861764,-1.8487919864514415,-0.5333783323331674,-1.310297183757364,-1.962779314560478,-0.29586294472753555,1.2601905199713175,0.2258623335479983,1.164028842034106,1.2601762485889645,-1.6198229221332971,-0.19940094653650764,0.9351061044738597,-0.8723662733450582,0.2875210167181073,-1.4472763531061303,0.905617238681307,-1.212092467279615,-0.4059577651591038,-0.049353199427741926,-0.10718085793039525,1.3154673388256952,-0.3416899315074888,-0.9635711742203847,0.744338965743411,-0.5601326434471046,-0.9772813005967932,-0.4142720048246363,-1.2072930734276848,-0.0637472401829505,0.27508685497813434,-1.7532303900463644,-0.2711244689023833,-0.24752626984568707,-0.6585869885045919,-1.7904630892032412,1.3439583157006354,-0.40420078707498047,-0.3861649633979502,-0.23315866838582855,-0.517952334405128,-0.10253396614652134,-1.7252605432461694,0.508346913429699,-0.9851173243444596,1.4199922057927348,0.19944110921438213,-0.21506296073840564,0.491881335376552,-0.49924124683133264,0.5179475743383115,-1.3443455646151428,0.8394078416222844,-0.939925609297033,0.8936502835922606,-1.235069102951214,-1.149969216938906,0.5641521792653462,-0.33828000109639506,-0.7008449814419991,1.1165355788996316,2.0874569503068896,-0.7842850416601074,-1.0236736911547528,0.6721748871909491,-1.341525889084005]\n", "}\n", "}],\n", "\"theme\":{\n", "\"axis_title\":{\n", "\"blank\":false\n", "},\n", "\"axis_text_y\":{\n", "\"blank\":false\n", "},\n", "\"axis\":\"blank\"\n", "}\n", "},\n", "\"height\":null\n", "}]\n", "};\n", " var plotContainer = document.getElementById(\"Ipey6j\");\n", " window.letsPlotCall(function() {{\n", " LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n", " }});\n", " })(); \n", " </script>" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "GGBunch().addPlot(histogram + upper_theme + scale_x, 0, 0)\n", " .addPlot(scatter + lower_theme + scale_x, 0, 200)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Adjust plot sizes\n", "\n", "*addPlot()* method has two more (optional) parameters: *width* and *height*.\n", "\n", "This values will override plot size earlier defined via *ggsize()* function." ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/html": [ " <div id=\"RoGXI2\"></div>\n", " <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n", " (function() {\n", " var plotSpec={\n", "\"kind\":\"ggbunch\",\n", "\"items\":[{\n", "\"x\":0,\n", "\"width\":600,\n", "\"y\":0,\n", "\"feature_spec\":{\n", "\"mapping\":{\n", "},\n", "\"ggsize\":{\n", "\"width\":600.0,\n", "\"height\":200.0\n", "},\n", "\"kind\":\"plot\",\n", "\"scales\":[{\n", "\"aesthetic\":\"x\",\n", "\"limits\":[-3.5,3.5]\n", "}],\n", "\"layers\":[{\n", "\"mapping\":{\n", "\"x\":\"x\"\n", "},\n", "\"stat\":\"bin\",\n", "\"position\":\"stack\",\n", "\"geom\":\"histogram\",\n", "\"fill\":\"dark_magenta\",\n", "\"data\":{\n", "\"..count..\":[0.0,0.0,1.0,1.0,0.0,3.0,3.0,4.0,10.0,12.0,26.0,30.0,41.0,33.0,40.0,41.0,35.0,29.0,21.0,25.0,21.0,10.0,6.0,4.0,2.0,0.0,1.0,0.0,0.0,0.0],\n", "\"x\":[-3.541222222222222,-3.2969999999999997,-3.0527777777777776,-2.8085555555555555,-2.564333333333333,-2.320111111111111,-2.0758888888888887,-1.8316666666666663,-1.5874444444444442,-1.3432222222222219,-1.0989999999999998,-0.8547777777777776,-0.6105555555555555,-0.3663333333333334,-0.12211111111111084,0.12211111111111128,0.3663333333333334,0.6105555555555555,0.8547777777777781,1.0989999999999998,1.3432222222222223,1.587444444444444,1.8316666666666666,2.075888888888889,2.320111111111111,2.5643333333333334,2.808555555555555,3.0527777777777776,3.297,3.541222222222222]\n", "}\n", "}],\n", "\"theme\":{\n", "\"axis_title_y\":{\n", "\"blank\":false\n", "},\n", "\"axis\":\"blank\",\n", "\"axis_text\":{\n", "\"blank\":false\n", "},\n", "\"panel_grid_major_y\":\"blank\"\n", "}\n", "},\n", "\"height\":100\n", "},{\n", "\"x\":0,\n", "\"width\":600,\n", "\"y\":100,\n", "\"feature_spec\":{\n", "\"mapping\":{\n", "},\n", "\"ggsize\":{\n", "\"width\":600.0,\n", "\"height\":200.0\n", "},\n", "\"kind\":\"plot\",\n", "\"scales\":[{\n", "\"aesthetic\":\"x\",\n", "\"limits\":[-3.5,3.5]\n", "}],\n", "\"layers\":[{\n", "\"mapping\":{\n", "\"x\":\"x\",\n", "\"y\":\"y\"\n", "},\n", "\"stat\":\"identity\",\n", "\"color\":\"black\",\n", "\"alpha\":0.4,\n", "\"position\":\"identity\",\n", "\"geom\":\"point\",\n", "\"data\":{\n", "\"x\":[-0.6744640199025198,1.1688609933155418,-0.7798635003683787,-1.0575765850104435,-0.21133517484449102,-0.43703695115361535,-1.164777495612634,-0.5814437773139531,1.4325041796167088,1.2263820001713754,1.1286164161324417,-0.22825957758128768,-0.4004713771601831,0.6664538499624992,-0.10279704526589616,-0.6718952577246665,0.11606385517388161,-2.158497089938217,0.32729536035251305,0.8410159607062793,-0.46849691977181085,-0.4109888165401843,-0.1859037174307802,0.17509272671447068,-0.415285336588659,-0.23822814898234984,0.8038433766389336,-0.5346942523026389,0.07625398874397708,-0.5820054223326827,-0.6455726139124609,0.5904200735386678,-2.2088222612659965,0.282563605446129,0.2456626168541644,-0.12972861958357146,1.9362386971988845,1.007454364566747,0.27505632953838816,1.67458063198,0.7911157220043826,-1.095892638267239,-1.1063779379551584,-0.1393810695701042,2.913288850052117,0.6904564793847627,0.7400690642955501,-0.46959889661032184,1.341406123781579,0.30664512125115884,-1.3263569627601735,1.038231141062499,-1.5174427563160675,0.6864031278524461,-0.7454420605309788,1.992713666493837,0.5593647083868054,0.45130115874528715,1.5425685716647353,-0.9605146246361498,-0.08523419271875438,1.111435961359105,-0.8524110466531205,0.1614934389407704,0.1571394859285564,1.067315278685693,0.621806599851275,1.5493862830807028,-1.1336113094003275,1.442415378514537,-0.6961723889302749,0.12197337141661355,-0.28392754338046744,-0.7038151371673095,-0.6878249924054599,0.6976187437879244,0.6273765488641239,-0.3993781932341655,-0.15560729174098611,-0.2806713570403014,0.5013085190606195,0.6106377354016977,-0.4893869942232398,1.9801775390874534,0.5741506800233674,-0.6724596427198881,-0.47822448541630436,0.27202580262527665,1.4280074398490983,1.0605876647876462,0.009427070708191973,0.3046331171047675,-0.5240961069893961,0.9141556511392445,2.0146839535666983,0.6579552852739827,0.3620035267256028,-0.6155136694769258,-1.3059734083292327,1.1804347811503173,-0.00878255187277409,-0.4855523693255114,-0.4268632688904139,1.3740850493928483,-0.5759900916662539,-0.3641767940830528,-0.6872737505724394,-0.6204913005009245,-1.062716561716572,1.0441178467310759,1.0574628436773703,0.2749536947264239,-0.05564571090795107,0.5898848385633713,-1.2574405331080798,-0.343856678542779,1.7727854698384218,0.44062598938709463,0.052173725141496353,-1.3419897472693638,-1.2485293393451584,-0.9858255966527361,-0.14233376465120176,-0.8906901957309995,0.1290914034077799,-1.2441492311975322,0.8606772012240371,-0.5732537081333599,-0.4747454050196354,-1.2777245800353252,0.6650410527153144,0.2736966295543624,0.275793362642477,1.2615129908036915,1.0741155929716693,0.07846385544461255,-0.38214793847042927,-0.4255912480644681,0.7930608875535996,-2.106753628258502,0.5475489356145378,0.4368452462753567,1.0161221301289975,-0.5632332300060781,-1.8477430614769195,-1.0472677511269095,-0.3542092544313052,-0.6163504115919833,-1.4453216467453514,-0.7544764199230152,0.35459637023800367,-1.5081932379179162,-1.6508922833016837,1.5797471495564652,-0.3090123656408648,-1.928443006525644,0.12391837091500493,1.2967316779965619,-0.7251034228383786,-0.0865116533475522,0.13270334003362758,-0.7070680026276068,-0.338809191616442,0.51292942969293,0.8850030193216443,-1.6038464582240335,-0.06380557043187186,1.3505934493395373,-1.1670499785467299,-0.05152331263614816,0.5785698151327001,0.14613622968091022,0.4421517291901596,0.9588054111507096,1.3711321535645093,0.23394531985372047,1.7482867092568144,-0.4252669320927708,0.8418949362763407,0.3551069063529994,1.0527696876422186,-0.6520396236217345,-0.22885246721890842,1.2840084983090168,-0.6881940466475199,0.16874703734057184,1.2727230364194406,0.36642299951376406,-0.6867301957900299,0.992305214707094,-0.20765586720306084,-0.5502492039908247,1.325219003277658,-2.2021464492971665,1.0054470224123828,-1.5772445879240753,-0.6078661269222209,-0.9048779353319325,-0.18187790309928129,-1.6172087565802113,-0.5463903345650736,-0.7703380148862496,0.3663034267556162,-0.6316812822572508,0.3080504688778069,-0.1908768968623617,-2.6963049137652613,0.10986883745211973,-1.0798596306307144,1.810514927017933,-0.6228312468938239,-0.2608657864505899,-0.13150365935394379,-0.467972547001626,1.797985242671896,0.1154289011371147,0.1595548347155912,-0.07393776081132851,0.5307735884849949,-1.022859114386942,-0.39298290799971497,0.7775511666560517,1.3725783778787235,-0.6289832768725503,-0.3961713261491232,-0.7141265366397814,1.9303813648030068,1.635166941821612,-0.5288559606592628,0.3823916781127417,-0.7867284817392186,-0.7514353671687319,0.42227776027954034,1.164734665795169,0.07448332065658074,-0.9513944136215156,0.15551831890151738,-1.2419776616947893,-0.19315370692280487,0.06301873859514497,-0.6683036338964441,-0.9810018132858906,-0.9984894495575073,-1.4858876828970087,1.023863492449694,-0.10755987494996634,0.41569482181237405,-0.22883460527361998,0.1853587129128223,0.7839560148234038,-0.5467427014709897,-1.338671276709058,0.318195841624596,1.4578434658924702,-0.2157935114973045,0.7901579860854885,0.008154189031804027,-0.7892662415596127,1.565774609411783,-0.7728112585429747,0.4813685943054223,-0.03555637763560912,-1.9570883274099817,0.3412855912215129,-0.2964533867494741,-1.3183553555323142,-1.1065204582306896,-0.18697235266440285,0.2210624987814711,-0.46804694996823515,-0.8709796665110143,-0.7491536758306041,-0.7373377424027923,1.3109038321853528,0.9242882106369306,1.1769784833105585,0.9548491991754234,1.0350417408583006,0.4240043021497952,-1.2509812748213214,-1.000617204015416,0.36864841621115024,0.33260744760968275,-1.206560499939688,0.6822030185642028,0.4729761182738336,0.4544524343009744,-0.35197522169199064,-0.11721057304590095,0.7016903092926798,1.0849161816518795,-0.7817242054666317,-0.7349145187158622,0.0063144856188233085,1.11192020239858,0.546813574410527,-0.8565734065917627,1.010644425113122,-0.3636820014661913,-1.1185560996978599,0.0681672427771298,-0.14090146398569794,1.5296031000730816,2.3639753311004954,0.49750518072204564,-1.012076584977165,0.586548738845585,-0.04060150187383195,1.093236677861897,-0.2189874966792859,-1.8543973631932458,-0.4918628070728557,0.23744916194094381,-0.0011216629891699754,-1.0633039037442018,0.8605154110028084,-0.024949637789862804,-1.1527172478944787,1.4640949689936218,-0.3648134482878574,-0.8490796069267117,0.058402753362986656,-0.44458011129741143,0.7428634562657651,-1.8210667548223796,0.3765034605130482,-0.8338884659358015,0.16728454677695495,-2.3764310421139307,-0.7816594611764757,1.3298731271168391,1.4290880297252289,-1.0451312953919853,-0.7922692863469232,0.261180836448762,0.8086315833784016,-0.9062271305897804,-0.7991779130868759,0.03404238715302243,0.2502286566601771,1.4967743097931494,0.23731823410810535,-1.0002542736029052,-0.6314434285522788,-0.03692412288482845,1.014056561922927,1.487643646810606,0.049615710675105736,-1.1145834188054784,0.7075326072412758,0.2712816584999319,-1.141908031042825,-0.9014366910920025,-0.09065973343509498,0.5082448338268991,-0.5599985658526059,0.5195560173676982,-0.9756539857667424,-0.3854980643799661,0.17324099945895904,2.0736451959971127,-1.4815292264732338,-0.5896044898970765,0.06952546624886935,0.1397733360451365,-0.6915365754281684,1.611269862564514,-0.7933328463910049,-0.5281587635918719,-0.6035286100309599,-0.9477183417341062,0.15498445359372398,-2.9880191108687817,-0.14845508081967465,-3.579194043126726,0.20764044930214787,0.2051333495616271,0.757197148229616,-0.8222884943170924,-0.2378240500504717,0.17179296925937573,0.8732075014438977,0.2147610851018894,0.7027551944543391,1.1095994434030567,-0.3876001734446714,-0.020310634441371968,0.674927289513476,-1.0355101392496213,2.2239167947252447,-1.0907579889739671,1.2864383960299692,0.794428024789826,0.5893058325723117,-0.08748679403195728,0.08993060728462124,-1.5811792996355263,1.2981338651688155,-0.1704016716225429,-1.6895124979602294],\n", "\"y\":[0.6661602010520571,1.270394779913487,-0.8057208237718527,1.735820325391944,0.7868455065432844,-0.17093352852816965,0.3447412143680761,-0.49870439796579213,1.9348226702746807,0.39668241487834416,1.2116230775512813,-0.5220070116369592,-0.925076710867466,0.8072362025186218,-0.40061881919633885,0.511028340092403,0.13725152337277255,-0.09419033560427485,0.8041814042307718,0.01967303568025677,-1.6015338416178044,0.5951910558078379,1.6806096679236213,0.7457129888784676,-2.0789763467307343,0.3412101846751085,0.11924010124190376,-1.1863467396888525,-0.15383189854418122,-0.4821865099703338,1.7467482414242215,-0.7006607639026755,-0.34773525036210706,-0.4151204967957861,-1.5032148285874696,-0.12529183593225476,0.6156337854767402,1.0993629219449024,-0.349634295623502,-0.6212616861123954,-1.419792938577749,-0.9717833353615182,-0.7069155215573859,-0.9496910845617567,-0.7867901733075993,0.511476561814012,0.41299416522189775,2.2576077474543155,0.04756504701604761,0.33630290766523036,-0.395634525321286,-0.2558607499857383,0.5413422961354568,1.3835682423938225,-0.6026172641494515,-0.21712271701580865,-0.6462257030121765,1.277547764420519,-1.1031886378891851E-4,0.7020194229609626,1.680110170634347,-0.7129559114154423,1.3124638577922958,0.6999069837652357,0.3687801010518353,0.48729408960506676,-1.9498325722776035,-0.41641852914490574,-1.5976165972731982,0.45300127300211934,-1.2458556398607952,0.5017029853261534,1.8652006385209974,0.5436923988427741,-0.9236901757070967,0.3890025423371501,-0.7499049670498529,0.7838730219418087,-1.6063029389504475,-0.008658674674104977,1.663716507212271,1.6852412396190222,0.6399942740853949,0.6805644526009091,0.3263252455603378,1.5360904505222914,-1.0308623290749828,-1.0590248837209169,0.7398169628587751,-1.9786633987987332,-0.48265117841086447,-0.3853938776245876,-0.2809202928613043,-0.16796591386658746,-1.2304759777310212,-1.109631165439823,-0.5773037006302898,1.3331144497076641,0.7503244906768306,0.4497678141094829,0.13607615677095608,-0.30423007635962607,0.07667780159047334,0.2539128195449736,0.28501837938448643,0.09700451749730972,-0.08220749654206347,-0.02659997793193712,-1.335049448682979,1.6929469381377789,0.3944413449819634,-1.2339544251330405,-0.2031091321032242,0.2469771245493247,-0.28499819749338784,0.367271636780082,-2.615485846927002,-0.17690338009758377,0.007401587665870942,0.8641096838523415,-0.24689236579662807,-0.04804891978589835,-1.4308661512054395,-0.31489533804846837,0.43597562169899956,-0.7834052471459008,-0.49494788373426246,0.10644118295037602,0.5888137968689542,2.266262715631338,0.29603195381193637,0.326015946425065,-1.3660486658948519,-0.9592409430165723,-0.0630237756444974,0.6985736113148365,0.8458839805024344,0.5152976969300707,-0.6042580318342613,-0.13261633603649114,-0.2877378427982844,0.33960954882708644,0.7513732025416191,-0.5407966984690689,1.1679653401843288,0.884312993997179,0.308535147323782,0.967351137961291,-0.4402244474693009,-1.0569358530671753,-0.07364049457009965,-1.294621789773702,1.0710564893126344,-0.9084820367832598,0.08135082296317361,0.11129637116824853,-1.0015276728748064,-2.4892824949118677,0.6045616863159997,-0.5935785984022471,0.501178731855949,0.8431846973874959,-0.34141204628342364,1.5600067687761343,1.28758871105485,1.461279487669829,-1.4994310598294114,0.2798786555448607,1.4061847172023074,-0.07224883348822239,-0.4104103269454383,0.49523688957468204,1.8351561198228457,-0.1639552903024566,1.4246619833172218,-0.685011120624986,0.273265833584567,-0.21924761496406908,-0.5035957928945841,0.6530931731693584,0.4750839038354609,-2.0274325134252034,-1.9065469128556307,1.2188414280921194,0.34362606643444693,-0.1526572696321081,-0.4698200482154767,0.4134218214559642,0.4252579808462775,-0.7321593578082719,-0.43525739769038074,-0.48625782977803605,-2.083035343824787,0.14384991642746636,-1.6529338266994753,-0.6350114758611285,-1.6681439164808158,-2.2276915053720994,0.1363831230758303,1.6163616972799912,-0.7459164843393543,2.1067030970715397,-0.17470801001639483,0.9910087384434383,-0.6814246302856187,0.3515225936187945,0.5640234935829792,-0.6740818463433754,-0.3935337290451268,-0.2393325269969546,0.24565191576507442,-0.5497986267759223,-0.13272532421753688,0.18605623512050912,1.5996079500350842,-0.3232125316252129,0.368077265338442,-1.2878746752950607,-0.029924290341881925,0.46483519582236765,0.21136854600086577,0.6603102954286026,-0.823471511909781,-0.08041298890549176,0.8644282304924725,-0.26616366911946066,-1.5566551664873147,0.4286117014945917,-0.6533287966519005,0.48835395302773776,1.6009930949035922,0.0631512638825802,-0.7415863591777397,0.47264996113012875,-0.9451334535711523,0.5295458199064564,-0.814412342292681,-0.8443886659659555,-1.8182723279942894,0.6687683849585785,-0.22905112746593675,-0.062242134943014234,1.5318333731381506,1.1946830035154299,-0.364361633199291,-0.9883269899587411,-1.031772402899363,-1.6418495968573268,0.8328566651733088,-0.57751062549269,-1.6900832557944294,1.6678024876651931,-0.7120529334191709,0.5861777009912414,-0.18733380973234726,0.621700061233281,-0.6716112883678875,-1.6563930622412077,-1.876144320075645,-1.457109956054859,0.2419744211596227,-1.1005627519199772,1.1039546818963242,2.6997786595999957,-0.3620843714884368,1.55354842399825,0.5972181692598149,0.44283010806347967,-1.4680658662958304,-2.267316249485942,-1.0487421799045624,-0.018596681165419023,-0.8001970740422907,-1.406450107673903,-0.5509049056739228,0.6754627588178578,-0.06884619560386458,-0.42782431758530143,1.2213749520812753,-1.5902454518427525,-0.844842017372366,1.8877488199738104,1.7017554253461908,0.5246189289944397,-0.9287646730712531,-1.4517564224839037,0.5122933201712003,-0.19647652499600554,-0.7417421487177752,-1.2163309507935638,0.2880900728298288,-1.7780969866913972,-0.5805496197755603,-0.3800594716663436,-1.3112561573749872,-1.2373128133396845,-0.09456367364942278,-0.7245060018671905,1.971038301776271,1.1220550741127149,0.04202960869284377,0.011016378533954742,-1.3713917193129093,-0.7614790341645236,0.20864574248058737,-1.6797548037073005,-0.27943214388735954,0.845984890866596,-0.32354589715107107,-0.16646427590890103,1.12420618678173,-0.8111943161922545,-0.5580894017246969,-0.43189136749197027,-0.20865026057767122,0.5080631258988317,0.12486086720026708,0.17917070373765018,0.002132960571923035,0.5878865536896458,0.16979301793813076,-0.16138332018055732,-0.5539608098814934,0.4020107395019965,-1.3356990444959138,-0.22929716389461488,-0.016639210193379956,0.17449713411670062,-0.34002052123609006,-1.0242903068489628,0.7661025666586033,0.43135537241935323,0.3830984050562818,0.029341773251223342,-0.9524355819861764,-1.8487919864514415,-0.5333783323331674,-1.310297183757364,-1.962779314560478,-0.29586294472753555,1.2601905199713175,0.2258623335479983,1.164028842034106,1.2601762485889645,-1.6198229221332971,-0.19940094653650764,0.9351061044738597,-0.8723662733450582,0.2875210167181073,-1.4472763531061303,0.905617238681307,-1.212092467279615,-0.4059577651591038,-0.049353199427741926,-0.10718085793039525,1.3154673388256952,-0.3416899315074888,-0.9635711742203847,0.744338965743411,-0.5601326434471046,-0.9772813005967932,-0.4142720048246363,-1.2072930734276848,-0.0637472401829505,0.27508685497813434,-1.7532303900463644,-0.2711244689023833,-0.24752626984568707,-0.6585869885045919,-1.7904630892032412,1.3439583157006354,-0.40420078707498047,-0.3861649633979502,-0.23315866838582855,-0.517952334405128,-0.10253396614652134,-1.7252605432461694,0.508346913429699,-0.9851173243444596,1.4199922057927348,0.19944110921438213,-0.21506296073840564,0.491881335376552,-0.49924124683133264,0.5179475743383115,-1.3443455646151428,0.8394078416222844,-0.939925609297033,0.8936502835922606,-1.235069102951214,-1.149969216938906,0.5641521792653462,-0.33828000109639506,-0.7008449814419991,1.1165355788996316,2.0874569503068896,-0.7842850416601074,-1.0236736911547528,0.6721748871909491,-1.341525889084005]\n", "}\n", "}],\n", "\"theme\":{\n", "\"axis_title\":{\n", "\"blank\":false\n", "},\n", "\"axis_text_y\":{\n", "\"blank\":false\n", "},\n", "\"axis\":\"blank\"\n", "}\n", "},\n", "\"height\":300\n", "}]\n", "};\n", " var plotContainer = document.getElementById(\"RoGXI2\");\n", " window.letsPlotCall(function() {{\n", " LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n", " }});\n", " })(); \n", " </script>" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "GGBunch().addPlot(histogram + upper_theme + scale_x, 0, 0, 600, 100)\n", " .addPlot(scatter + lower_theme + scale_x, 0, 100, 600, 300)" ] } ], "metadata": { "kernelspec": { "display_name": "Kotlin", "language": "kotlin", "name": "kotlin" }, "language_info": { "codemirror_mode": "text/x-kotlin", "file_extension": ".kt", "mimetype": "text/x-kotlin", "name": "kotlin", "nbconvert_exporter": "", "pygments_lexer": "kotlin", "version": "1.7.0-dev-1825" } }, "nbformat": 4, "nbformat_minor": 4 }