{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "data": { "text/html": [ "\n", " \n", "\n", "\n", "
\n", "\n", "" ], "text/plain": [ "#[0.9830872428418371, -0.6225603167819811, -1.8927429261234985, 0.3620417301915362, -0.8967459358524024, 1.5693420544788879, -0.07209956504841974, 0.13355848945233983, 0.18059236921397037, -0.9929317709149887, 0.6420493212346221, 1.2666229469234862, 0.2795420669676125, 1.5733582432519486, 1.008607379593721, -1.494596456886732, -0.7199443463025381, -1.2933920337711577, 0.6182474107839244, -1.7934569650563699, -0.1517253205683584, -0.5368512662302765, -1.9344860908218133, -0.0478847044940931, -0.2677213348758505, 0.09018520519235063, -0.7167723146640146, -0.7236792766516218, 1.36905614305749, 1.2918895211283181, 1.4486912964720937, -1.5789298545505637, 0.3731347053092362, 1.19266386822612, -0.6699012127742399, 0.47249573284765445, -0.9496941782848967, -0.13546443019163945, -1.1351345838320337, -0.7232932184696264, -0.6948411338760927, -1.525885404920444, 0.5259016250315351, -0.6253247461324749, -0.05946292176105805, -0.06382740019979583, 1.7278844016794217, 0.13337981507349506, -1.209015254024421, -1.7734902232332188, 0.4616553106917958, -0.739717530983631, -0.2957879066221283, -1.649982595578162, -1.2288183522659253, 0.7506158917996504, 1.676527254501626, -0.44970978611523327, -0.09440148916302382, 0.6973834637913869, 0.7213603427333002, 0.4795520166151541, 0.17444222360431771, 0.46907480686981406, -0.8200283198901261, 1.4486437667524865, 0.5118384351441909, 1.9705908811169155, -0.27857958507676095, -1.0500317981403309, -1.4089154299678368, 0.02124590571956375, -0.548073563619607, 0.7751855903961884, -1.600463831766561, 0.4132203397200862, -0.20639510636106673, -0.06644707042592968, -1.476213226650383, 0.15233939848949296, -0.5137663476822296, 1.0149235388769742, 1.9130911733481755, 1.8508001493623563, -0.04132013555595515, -1.3424640697831824, -1.8040549987607384, 0.8398217257160154, -0.13398376359694453, 1.054566956239984, -1.192236640012144, -1.0018219627750864, 1.0591464483713748, -1.0832181741273974, 0.9280572333135351, 0.009668021231714619, 0.8673731196925516, 0.9577732730386979, -0.6597110352767763, -0.9778170463783389], :y=>[0.3235808471765018, 0.2988918879324791, 0.20862401922350426, 0.371798692850025, 0.18467527451358334, -0.11099213236821348, -0.2294685068760065, 0.7633851388122197, 0.4668827341799422, -0.701166222790357, -0.19955835447226078, -0.7929997738495342, -0.3674009612664828, -0.27983463429837596, 0.6681020285301886, 0.45231576101009074, 0.7136146874523166, 0.3971986812000863, -0.45162611173420997, 0.9370488678419244, 0.487683749146691, -0.4523058428184794, -0.6137442454568012, 0.7234624498386468, -0.8580025742404265, -0.8952365278204981, -0.09713788849454041, 0.46801522862498723, -0.3071396641323063, -0.4177566081548105, 0.6877883694835158, 0.41081999652773216, -0.3493185259795686, 0.8366756946008098, 0.2705686266505456, 0.39547326250614634, 0.8506909888327219, 0.8271780546984624, -0.7165216665661047, 0.7042164958468469, -0.36148601766412636, 0.6629635790037178, 0.1125482411682226, -0.47902240994993717, 0.2542101298537811, -0.05799729578641544, -0.09279168806485605, -0.16328893677557965, 0.2506203454024045, 0.4655367021133021, 0.5171815321531679, 0.7497714725582865, 0.15795731957241999, 0.11689779887393414, -0.21276054236773323, -0.3251365074041408, 0.17450014361807642, 0.47764071968945787, 0.38461096054872845, 0.4434609251689494, 0.915425972432268, 0.8520887381958715, 0.13354512278748776, 0.4364230177690194, 0.8721019754502335, 0.5917902227140659, 0.9792119165613946, 0.6692188104007004, -0.5660322881343227, 0.5862904575208066, 0.2967423766103181, -0.3128825156321309, 0.09736383435871132, 0.5110664929240891, -0.8815665015513938, -0.079340193709444, -0.6192953726916963, -0.5749801634656355, 0.4042520884820924, 0.7169771749951117, 0.38277248070074466, -0.6849891843473535, -0.7420083125086145, 0.865723013818845, -0.6614814038930834, -0.400953840016808, 0.4641653101078067, 0.4922206811159511, 0.45277683725445494, -0.6815557463706996, -0.12861311906255812, 0.35132557397247055, 0.36138319697419896, -0.8848025359543659, 0.14725461748832336, -0.010147229192302376, -0.5470315230046927, -0.9376669396886039, -0.7662181340049801, -0.840462742778207], :mode=>:markers}], @layout={:title=>\"Simple Scatter Plot\"}, @config={:linkText=>\"Export to plot.ly\", :showLink=>true}, @embedded=true>" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Simple Scatter Plot\n", "require 'rbplotly'\n", "\n", "n = 100\n", "x = n.times.map { rand(-2.0..2.0) }\n", "y = n.times.map { rand(-1.0..1.0) }\n", "trace = { x: x, y: y, mode: :markers }\n", "\n", "plot = Plotly::Plot.new(data: [trace])\n", "plot.layout.title = 'Simple Scatter Plot'\n", "plot.show" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", " \n", "\n", "\n", "
\n", "\n", "" ], "text/plain": [ "#[0.0, 0.010101010101010102, 0.020202020202020204, 0.030303030303030304, 0.04040404040404041, 0.050505050505050504, 0.06060606060606061, 0.0707070707070707, 0.08080808080808081, 0.09090909090909091, 0.10101010101010101, 0.1111111111111111, 0.12121212121212122, 0.13131313131313133, 0.1414141414141414, 0.15151515151515152, 0.16161616161616163, 0.1717171717171717, 0.18181818181818182, 0.1919191919191919, 0.20202020202020202, 0.21212121212121213, 0.2222222222222222, 0.23232323232323232, 0.24242424242424243, 0.25252525252525254, 0.26262626262626265, 0.2727272727272727, 0.2828282828282828, 0.29292929292929293, 0.30303030303030304, 0.31313131313131315, 0.32323232323232326, 0.3333333333333333, 0.3434343434343434, 0.35353535353535354, 0.36363636363636365, 0.37373737373737376, 0.3838383838383838, 0.3939393939393939, 0.40404040404040403, 0.41414141414141414, 0.42424242424242425, 0.43434343434343436, 0.4444444444444444, 0.45454545454545453, 0.46464646464646464, 0.47474747474747475, 0.48484848484848486, 0.494949494949495, 0.5050505050505051, 0.5151515151515151, 0.5252525252525253, 0.5353535353535354, 0.5454545454545454, 0.5555555555555556, 0.5656565656565656, 0.5757575757575758, 0.5858585858585859, 0.5959595959595959, 0.6060606060606061, 0.6161616161616161, 0.6262626262626263, 0.6363636363636364, 0.6464646464646465, 0.6565656565656566, 0.6666666666666666, 0.6767676767676768, 0.6868686868686869, 0.696969696969697, 0.7070707070707071, 0.7171717171717171, 0.7272727272727273, 0.7373737373737373, 0.7474747474747475, 0.7575757575757576, 0.7676767676767676, 0.7777777777777778, 0.7878787878787878, 0.797979797979798, 0.8080808080808081, 0.8181818181818182, 0.8282828282828283, 0.8383838383838383, 0.8484848484848485, 0.8585858585858586, 0.8686868686868687, 0.8787878787878788, 0.8888888888888888, 0.898989898989899, 0.9090909090909091, 0.9191919191919192, 0.9292929292929293, 0.9393939393939394, 0.9494949494949495, 0.9595959595959596, 0.9696969696969697, 0.9797979797979798, 0.98989898989899, 1.0], :y=>[4.247470548881884, 5.169428895083312, 4.842244427723106, 6.823886837720078, 5.207335303369803, 3.2052687058727836, 6.836003685217147, 4.381255791307273, 6.49859753847609, 6.702391373171487, 5.470611394732682, 6.226536593155121, 5.740304440043028, 4.848230032947744, 5.058965858773757, 5.648584442330111, 4.111585103396571, 6.283024895137276, 5.340688938937516, 4.867547315990633, 5.165986609385863, 6.448152610429574, 4.6979409566741985, 3.6185006814237313, 5.366109009561779, 4.727838178227663, 4.623447644095657, 4.471351794853983, 6.281562638627852, 5.642252893227801, 3.8127461282674613, 5.088140041839074, 5.209501443555029, 3.208503653368289, 6.609156467748448, 4.237767847411515, 5.962925389183473, 5.12534908840254, 5.543164750755135, 5.022679413996901, 5.318711374291473, 5.5551187084058, 3.94587129534561, 6.436854924023905, 3.3774746370481123, 3.9679046475717814, 5.602877601235169, 4.353954737406442, 3.0870108206255633, 5.910873280604742, 3.5157246579910457, 4.774725459542218, 3.4323169902860333, 6.512701475356604, 6.835729279683669, 3.884742157386016, 6.505590495455239, 5.609943078052654, 5.042011972590753, 6.41924854114353, 3.0499973881819353, 3.039461163568763, 5.068708112159804, 6.991222081429316, 3.9993963513464585, 3.9353750740898827, 4.127861657102761, 6.681925156204539, 5.0071592708003045, 3.104939653632926, 4.620763583357126, 5.257296519522721, 6.151094311529544, 6.837031087255758, 3.471316325132468, 4.322848217411935, 6.616942324668534, 4.06859056833647, 5.582380648833455, 6.596840640058366, 5.040259276092109, 4.378199829794868, 5.831216755655913, 4.925677186120785, 4.502431125692542, 3.4760232283277337, 3.208553356299087, 4.428432183356875, 5.132268100535056, 6.482729663991031, 5.777880817747489, 5.520099822974071, 5.382124176710549, 4.862542219028493, 4.291177522197528, 6.437846935089938, 5.506734388772037, 3.412993940377485, 6.200609119700282, 4.986666392131754], :mode=>:markers, :type=>:scatter}, {:x=>[0.0, 0.010101010101010102, 0.020202020202020204, 0.030303030303030304, 0.04040404040404041, 0.050505050505050504, 0.06060606060606061, 0.0707070707070707, 0.08080808080808081, 0.09090909090909091, 0.10101010101010101, 0.1111111111111111, 0.12121212121212122, 0.13131313131313133, 0.1414141414141414, 0.15151515151515152, 0.16161616161616163, 0.1717171717171717, 0.18181818181818182, 0.1919191919191919, 0.20202020202020202, 0.21212121212121213, 0.2222222222222222, 0.23232323232323232, 0.24242424242424243, 0.25252525252525254, 0.26262626262626265, 0.2727272727272727, 0.2828282828282828, 0.29292929292929293, 0.30303030303030304, 0.31313131313131315, 0.32323232323232326, 0.3333333333333333, 0.3434343434343434, 0.35353535353535354, 0.36363636363636365, 0.37373737373737376, 0.3838383838383838, 0.3939393939393939, 0.40404040404040403, 0.41414141414141414, 0.42424242424242425, 0.43434343434343436, 0.4444444444444444, 0.45454545454545453, 0.46464646464646464, 0.47474747474747475, 0.48484848484848486, 0.494949494949495, 0.5050505050505051, 0.5151515151515151, 0.5252525252525253, 0.5353535353535354, 0.5454545454545454, 0.5555555555555556, 0.5656565656565656, 0.5757575757575758, 0.5858585858585859, 0.5959595959595959, 0.6060606060606061, 0.6161616161616161, 0.6262626262626263, 0.6363636363636364, 0.6464646464646465, 0.6565656565656566, 0.6666666666666666, 0.6767676767676768, 0.6868686868686869, 0.696969696969697, 0.7070707070707071, 0.7171717171717171, 0.7272727272727273, 0.7373737373737373, 0.7474747474747475, 0.7575757575757576, 0.7676767676767676, 0.7777777777777778, 0.7878787878787878, 0.797979797979798, 0.8080808080808081, 0.8181818181818182, 0.8282828282828283, 0.8383838383838383, 0.8484848484848485, 0.8585858585858586, 0.8686868686868687, 0.8787878787878788, 0.8888888888888888, 0.898989898989899, 0.9090909090909091, 0.9191919191919192, 0.9292929292929293, 0.9393939393939394, 0.9494949494949495, 0.9595959595959596, 0.9696969696969697, 0.9797979797979798, 0.98989898989899, 1.0], :y=>[-0.5180349952193395, -1.2466174037595437, 1.4538888066913511, 0.4347398094477337, 0.6341491553925813, -0.7657891381872628, -1.3928855521686416, -0.835663726499376, -0.4503788505282649, -1.407571101604188, -1.4108237930894059, -0.10934345626844166, -1.0670663593557026, 0.8147165361885089, -0.31298794936893115, 0.956494105090389, -1.0209467082359027, 0.7812707360399389, 1.6791217454396161, -0.15704535865981617, 0.1905243318157983, 1.4549506536220407, -1.4137584544957433, -1.073488024478361, 0.026390654670235936, 1.7165151806785448, 1.913480006216047, -0.9091510507303293, -1.5147183539806899, 1.9735194007179264, 0.0586441152738435, 0.6150766236302334, 1.4833116371543063, -1.4805287985596172, -0.051929430510845975, -1.5004084355786054, -1.586872129065926, 0.9369181581461996, -1.8805481916276139, 1.1361495003214213, -0.05236417188351172, -0.3757381912157354, 1.8528999981487417, -1.8259885984439412, 1.8552645968630346, 0.7295035827329457, 0.7261487934676008, -0.12850085420664836, 0.2224197063856419, -0.5181508633672931, -0.7268181146375157, -1.1897294086208543, -0.212645693097556, -0.42239358324636767, -1.8989767801692006, -0.990635074909, -1.2264446031432827, 0.05437570569077366, -0.34809093406520075, 0.6407588948636782, -1.7634089827541737, -1.6978797354395136, -0.19092047452274263, -1.5885913741273576, -1.0673668209950424, 1.723843911036321, 0.1482953498435471, 1.2958831333690255, 0.9822353376094282, -1.48091394032513, 0.5361183046421987, -1.469466707816471, -1.0803545132014882, -1.700982853405757, 1.1561616928409162, 0.753100934635035, -1.7709130828223754, 0.31397691640908043, 0.6282367475212403, -0.6427315131864102, -1.837743421796096, -0.8905293612767782, 1.2803365890010268, -0.39253863696012825, 1.5651156496980465, 1.5321140697111928, 1.239172355068853, -0.5373103488494424, -0.7657637211696771, 0.6168303243474016, 0.32705333773711676, 1.7610578268634693, -1.2669824732907715, -1.4261060331948814, -0.845817806461111, -0.4313244011001487, 0.9750419961661314, -1.2079509771964685, 0.6141435216204458, -1.875417497563154], :mode=>:\"markers+lines\", :type=>:scatter}, {:x=>[0.0, 0.010101010101010102, 0.020202020202020204, 0.030303030303030304, 0.04040404040404041, 0.050505050505050504, 0.06060606060606061, 0.0707070707070707, 0.08080808080808081, 0.09090909090909091, 0.10101010101010101, 0.1111111111111111, 0.12121212121212122, 0.13131313131313133, 0.1414141414141414, 0.15151515151515152, 0.16161616161616163, 0.1717171717171717, 0.18181818181818182, 0.1919191919191919, 0.20202020202020202, 0.21212121212121213, 0.2222222222222222, 0.23232323232323232, 0.24242424242424243, 0.25252525252525254, 0.26262626262626265, 0.2727272727272727, 0.2828282828282828, 0.29292929292929293, 0.30303030303030304, 0.31313131313131315, 0.32323232323232326, 0.3333333333333333, 0.3434343434343434, 0.35353535353535354, 0.36363636363636365, 0.37373737373737376, 0.3838383838383838, 0.3939393939393939, 0.40404040404040403, 0.41414141414141414, 0.42424242424242425, 0.43434343434343436, 0.4444444444444444, 0.45454545454545453, 0.46464646464646464, 0.47474747474747475, 0.48484848484848486, 0.494949494949495, 0.5050505050505051, 0.5151515151515151, 0.5252525252525253, 0.5353535353535354, 0.5454545454545454, 0.5555555555555556, 0.5656565656565656, 0.5757575757575758, 0.5858585858585859, 0.5959595959595959, 0.6060606060606061, 0.6161616161616161, 0.6262626262626263, 0.6363636363636364, 0.6464646464646465, 0.6565656565656566, 0.6666666666666666, 0.6767676767676768, 0.6868686868686869, 0.696969696969697, 0.7070707070707071, 0.7171717171717171, 0.7272727272727273, 0.7373737373737373, 0.7474747474747475, 0.7575757575757576, 0.7676767676767676, 0.7777777777777778, 0.7878787878787878, 0.797979797979798, 0.8080808080808081, 0.8181818181818182, 0.8282828282828283, 0.8383838383838383, 0.8484848484848485, 0.8585858585858586, 0.8686868686868687, 0.8787878787878788, 0.8888888888888888, 0.898989898989899, 0.9090909090909091, 0.9191919191919192, 0.9292929292929293, 0.9393939393939394, 0.9494949494949495, 0.9595959595959596, 0.9696969696969697, 0.9797979797979798, 0.98989898989899, 1.0], :y=>[-5.911562730593112, -4.7710669766536355, -4.65304148909687, -3.3043448744936725, -4.302016405739801, -4.74780881296411, -6.844880296667599, -5.407105266989042, -5.389455001533959, -5.093228405999657, -5.048176671850813, -4.324296929808622, -6.1643330032054955, -5.854584346648479, -5.754651057760054, -4.318160545732443, -5.401858942277179, -3.418475467420896, -6.6872010941882785, -4.597030172889722, -5.743369871427371, -3.308161973747469, -4.92773397736281, -4.620440425148205, -5.857311699118613, -3.8637004174743828, -3.215574832475108, -3.1155978017178074, -3.922273096575759, -6.879017168985545, -4.594617837641749, -5.893983494966882, -3.481054177965182, -6.270274731695452, -4.3768001220933765, -4.855396825767537, -4.286056827206488, -4.968593318193882, -5.615063329811569, -5.170771661351324, -5.343037984226849, -5.31911317233853, -3.879560181427026, -5.691647922277806, -4.781032278876815, -6.027027307745252, -5.828551344163651, -4.155881097484674, -5.3234644163569715, -3.906657906794074, -3.8232152502770367, -5.733463554438815, -4.7429348067706565, -3.0299545232310234, -3.101283769981061, -5.455566678109969, -4.199248188036956, -4.95797082650061, -4.535637646169345, -5.205730460721194, -5.987688381390624, -4.290308680302518, -6.502782831152736, -5.719608486548758, -5.735934709548534, -6.600278572889426, -6.448593832188314, -4.569348195620822, -5.257607105834079, -3.6198998912212885, -6.8237152179513, -3.309529967325279, -3.7448639732054247, -6.538190412369541, -6.931756919085865, -6.625812926806752, -6.997963791456476, -4.868413938235729, -6.122765905740515, -5.515869685563766, -6.428440486329031, -5.779286993197192, -3.7996303791845807, -5.008868848817141, -3.2040322319036414, -3.2969727012674173, -5.576545092183218, -3.517210833777502, -5.764760522484327, -4.352069990519425, -4.867620053856879, -6.070185005516046, -3.5345644569219763, -5.617451538939019, -4.435910573023019, -3.1464065020501666, -4.60367399076932, -4.039697657072183, -4.82523045085523, -4.7354618140367775], :mode=>:lines, :type=>:scatter}], @layout={:title=>\"Line and Scatter Plots\"}, @config={:linkText=>\"Export to plot.ly\", :showLink=>true}, @embedded=true>" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Line and Scatter Plots\n", "require 'rbplotly'\n", "\n", "n = 100\n", "\n", "x = n.times.map { |i| i.to_f / (n - 1) }\n", "y0 = n.times.map { rand(-2.0..2.0) + 5 }\n", "y1 = n.times.map { rand(-2.0..2.0) }\n", "y2 = n.times.map { rand(-2.0..2.0) - 5 }\n", "\n", "trace0 = { x: x, y: y0, type: :scatter, mode: :markers }\n", "trace1 = { x: x, y: y1, type: :scatter, mode: :'markers+lines' }\n", "trace2 = { x: x, y: y2, type: :scatter, mode: :lines }\n", "\n", "plot = Plotly::Plot.new(data: [trace0, trace1, trace2])\n", "plot.layout.title = 'Line and Scatter Plots'\n", "plot.show" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", " \n", "\n", "\n", "
\n", "\n", "" ], "text/plain": [ "#[0.408447943195168, -1.6799942842778268, 1.5885080384868746, -0.366687262204644, -0.37234049836155325, 0.8905521938964132, -1.989481179444843, -1.6130796556994262, -1.2882658154879705, 0.8988328171241764, 1.536496061182774, -0.3926413722629034, -0.1433584798531089, -0.408129083184412, -0.2640099777909408, 0.9584283429846772, -0.33517150830701414, -1.9167234781313787, -1.2199272854353054, 1.3850602838776216, 1.2193949310394805, -1.9910544260457206, 0.2324309243164273, 0.6782618696038121, 0.12614063799266617, -0.4361569945554553, 1.619704264017336, 0.8406289255714521, 0.4423830708657168, -0.1142976194907499, -0.7438705576570559, -1.7665558154494216, 0.01939164886392586, 0.12295292054859397, 1.2114188103194183, 0.11940661998504698, 1.0484627610409438, -0.19193819077282992, 1.875715964897707, -1.283398727951779, -1.0796208504149543, 1.7890582832450548, 1.802021826280627, 1.071328909947416, -1.1892367091093266, 1.656996941629283, -1.331337285354401, 1.176819417025147, -0.7497391160132891, 1.5247526981682493, 0.5970963184672984, -0.6691748360508796, 1.560239271155504, -0.9600390627758371, 0.35894388364275276, -1.9394802335597867, -0.5234996368625291, 0.3274374661164283, -1.1226113081517082, 0.9308146683988223, 0.5860382209047605, -0.9914030630331498, 0.2976772732206583, 1.0221650137019962, -0.9566972456057035, 0.35831386103400886, 1.4044337928393196, -1.1334740131466314, 0.9260178142923334, 0.5456614414231868, 1.5665616362766386, 0.6632900748439798, -0.6775173892891493, 1.4827553621977652, -0.2178207308215323, 1.1803860619313742, -1.9786467311253406, 0.9785981932623309, 0.44104940735907405, 0.4421545952423056, -1.3332034618322828, 0.3369751747368923, 1.5431362552977128, 1.05908337421713, 1.3185528186518796, -1.1716201520200555, -1.980526135910576, -1.7806676288472385, 1.5671694258974393, 0.4471592367726007, -1.8123072606343373, 1.8772407049994082, 1.923953141050056, 0.0957092212786641, -0.13205635155587858, -1.7563104539176053, -0.23058059261726216, -1.8897725179950666, 0.26421127706217007, 1.4950661550422293], :y=>[-0.1712722502368258, 0.9277347195960495, 0.7139326369436669, 0.9746097549959858, 0.5843030081893967, -0.17346109843429702, 0.7940281916926499, -0.3623788282217155, -0.071218073888073, 0.9229302190223962, -0.3661350296433239, -0.4358242848220819, -0.19289629726606572, 0.21638849883525535, -0.9259759346778751, 0.241060284049176, 0.055040329257568965, -0.1500773380613465, 0.21978343016298396, -0.15105385005400662, -0.3033829677018165, -0.45110640316938944, 0.46914174967103306, 0.1505702808511209, -0.28108030715223364, -0.6867741423852287, 0.04166353845249149, 0.232395835554301, -0.4182747741245354, -0.6159875344298218, -0.09486678852995123, -0.9237946289483296, 0.4589161233184671, -0.7429822067511569, 0.669686095052531, -0.9923117444255933, -0.19711423035948372, -0.715250035858408, 0.2700525309863653, -0.3412144509220034, 0.2274566387505268, 0.886283472217591, 0.4971809338751543, 0.9331592300052736, 0.5377880512632771, -0.8133091514074504, -0.1959184492825765, 0.42647480082472944, 0.8731137784366965, -0.3589863131579609, -0.82565876463856, -0.04484057819695275, -0.618056339016982, -0.5105230075426337, -0.9831899512780315, -0.2509682854607349, 0.43327932229122945, 0.4106315976797137, -0.9310488921033964, -0.5232768628901803, 0.05235498946850248, -0.680416440341703, 0.7924835836962842, 0.9634347250878459, -0.8299607670849249, 0.13185533243132874, 0.3428125408604812, -0.39364603298363066, -0.26348267489785004, 0.7728267246264373, 0.5844536089439596, 0.5502189628331731, 0.7781620352296954, -0.3708117000724165, 0.6121384520404245, -0.8641922239208224, 0.9214006069505383, 0.8980455989329967, -0.3135169488355265, 0.2667098861524515, 0.7808784845815313, 0.6409156584722056, -0.21950203040591054, 0.6932673778176266, 0.06578739446913384, -0.38383862093429433, -0.8546412102123011, 0.30417569113382736, 0.0666861856755212, -0.7789117335883231, 0.45569966338938395, -0.634635721183354, -0.9107403125862796, -0.9942175873057089, -0.32255119562428747, -0.025152748313265638, 0.6550356699643258, -0.5361039130372542, -0.17129223787990755, -0.7695528995454786], :mode=>:markers, :name=>\"Red\", :marker=>{:size=>15, :color=>\"rgba(200, 0, 0, .5)\", :line=>{:width=>2, :color=>\"rgb(0, 0, 0, .5)\"}}}, {:x=>[-1.1771517021481164, -0.5273477632172576, -1.331661001662237, -1.6869137982407318, 1.8240818872782119, -1.884120467676882, -0.9904138569172023, -0.20054996099324818, -1.29928716488544, 0.5957213818196494, -0.5393008266019894, 0.4917328440521236, -0.5003346560022255, -0.945483573064668, -1.2339370427292966, 0.6570349243550853, -0.7946844220086602, 0.45129207886723455, -0.4931138284510781, -1.8184659684046536, 0.26918475582889334, 0.8020354768011324, 1.769945288323329, 0.29644263128645987, 1.694203536472819, -0.03440251209717937, 0.49236732973323116, -1.6999709422833953, -1.115666120384656, 1.403115306510958, 0.979854398771776, -0.4642527612867662, -0.7351231311968118, 0.15657803856307417, 0.813690226435392, 1.3117502771609235, -0.3456254946478361, 1.792295357726314, 0.3676185851716496, -1.7424924085364473, 0.02522711507205111, 0.45041369346647553, -1.0832763968307826, -0.2068756493299797, -0.8815602728147809, -1.5444110748270465, -1.4068918750021178, -1.591200850420997, 1.854983807047502, -0.3996328506038931, -1.421711076741111, 1.1098377606989072, -1.9399635144689298, -1.4697502229785453, 0.8451061611490251, -0.03004260724751484, 1.6405789174001386, -0.6843506915922712, 0.7826976949291744, 1.4486786898296589, -0.27566870715187664, -0.7452831393706685, -1.3465695989279736, -0.707803561012275, -1.5248134524770744, 1.2517109989716841, -1.698422101510277, -0.8936716088555143, 1.0259116847234502, 0.6658360001378432, -1.4351753901057887, -1.4243272402121026, -1.4488862001040896, 1.0133308151484153, -0.39417924744365296, 0.6947792568490043, 0.633052447908101, 0.6039960641851199, -1.766046491505115, -0.5798265595182932, -0.7348799916687265, -0.9290347002737667, 1.2104272219106424, -0.5683061955980797, -0.5572915347592247, 0.04431247725985532, -1.6084664253895955, -0.7465910830667903, -0.45850357894209326, -0.6640641981784685, 0.07657012980491862, 0.7906525140253677, -1.667597014153933, 0.02740580105241941, -1.729316095460533, -1.1451393324118837, 0.1729224663790534, -1.8403456217635528, 0.5583963360622866, 1.4476928727282532], :y=>[-0.37836333200601313, -0.8332190838275382, -0.8055982119502088, 0.6950183099093798, 0.289535669944494, -0.9137124034600153, -0.1082084719079528, 0.34270649860618874, -0.7811716424440589, -0.3663345422632984, -0.3691950004155711, -0.2906977843353773, -0.9305719786393851, 0.612793458702743, -0.973164815870524, -0.40576578920398365, -0.9559539326860726, 0.8428523303095659, 0.4979307678389926, -0.6023844707729291, -0.4233384335912833, 0.6798163700032793, 0.9579034047204946, 0.061431825196619716, -0.3076394034784524, -0.3334524831458163, -0.8515356724532552, -0.12735797799876813, 0.3406256563806309, -0.21270604558958683, 0.8797700875045693, 0.24725025990617855, 0.4917859000915086, 0.5640538227559415, -0.12856350332069977, -0.08813349276050775, 0.4332995748250468, 0.4232565906605916, -0.3943502588290233, -0.6797947928758181, 0.7943898534262839, -0.4526627008802828, 0.6233133436446385, -0.11131103429623623, -0.3874748213676378, 0.8337355272040547, 0.2715167444572639, -0.8584321918627249, -0.6115634255070941, 0.22616285321084106, 0.7543730629979384, 0.8340983948005263, 0.3982042465559783, 0.7989100265645284, -0.9772153058979922, 0.6931705832906583, 0.6169356923497451, 0.6940690279752664, 0.9486272672811129, -0.9768050594045368, 0.0982642749541982, 0.8928613488640995, 0.957336246397755, -0.889760410323813, -0.27167549790352385, 0.8780461041075536, 0.9128317324935324, 0.25923784598940025, 0.4142070057305327, -0.3385147276101719, 0.39428277369592646, 0.37571934760751313, 0.018431039024757734, 0.9837491560526106, -0.20013418668112726, 0.21985465542350768, 0.6029292332755896, 0.824763969231465, 0.5827781893359794, 0.1047990785136299, -0.6909587610986805, 0.16829485818391965, 0.3950448701549232, -0.775258934556303, -0.5176142591218722, -0.34764806601780696, -0.9813655105280907, 0.8378389927949574, 0.20852533363106174, -0.8618070705150545, -0.02828836901444931, 0.7446566918137085, -0.17521321809111723, -0.22835389258552463, -0.3821892978900021, -0.23386800452723078, 0.04291637077951238, -0.676444748659714, -0.987982521135234, -0.2651135827346984], :mode=>:markers, :name=>\"Blue\", :marker=>{:size=>10, :color=>\"rgba(0, 0, 200, .5)\", :line=>{:width=>1, :color=>\"rgb(0, 0, 0, .5)\"}}}], @layout={:title=>\"Styled Scatter\", :xaxis=>{:zeroline=>false}, :yaxis=>{:zeroline=>false}}, @config={:linkText=>\"Export to plot.ly\", :showLink=>true}, @embedded=true>" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Style Scatter Plots\n", "require 'rbplotly'\n", "\n", "n = 100\n", "trace0 = {\n", " x: n.times.map { rand(-2.0..2.0) },\n", " y: n.times.map { rand(-1.0..1.0) },\n", " name: 'Red',\n", " mode: :markers,\n", " marker: {\n", " size: 15,\n", " color: 'rgba(200, 0, 0, .5)',\n", " line: { width: 2, color: 'rgb(0, 0, 0, .5)' }\n", " }\n", "}\n", "trace1 = {\n", " x: n.times.map { rand(-2.0..2.0) },\n", " y: n.times.map { rand(-1.0..1.0) },\n", " name: 'Blue',\n", " mode: :markers,\n", " marker: {\n", " size: 10,\n", " color: 'rgba(0, 0, 200, .5)',\n", " line: { width: 1, color: 'rgb(0, 0, 0, .5)' }\n", " }\n", "}\n", "\n", "layout = {\n", " title: 'Styled Scatter',\n", " xaxis: { zeroline: false },\n", " yaxis: { zeroline: false }\n", "}\n", "\n", "plot = Plotly::Plot.new(data: [trace0, trace1], layout: layout)\n", "plot.show" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Ruby 2.3.1", "language": "ruby", "name": "ruby" }, "language_info": { "file_extension": ".rb", "mimetype": "application/x-ruby", "name": "ruby", "version": "2.3.1" } }, "nbformat": 4, "nbformat_minor": 1 }