summaryrefslogtreecommitdiff
path: root/megapixels/notebooks/msc/test_plotly.ipynb
diff options
context:
space:
mode:
authoradamhrv <adam@ahprojects.com>2019-06-27 23:57:17 +0200
committeradamhrv <adam@ahprojects.com>2019-06-27 23:57:17 +0200
commitd61bb411957f31302a0a969de74baa68af126a07 (patch)
treed286701f18192a5536c831bf51e0195c7852407d /megapixels/notebooks/msc/test_plotly.ipynb
parentf414e2a442501fbbc689363a205de1b7a7d4c6c2 (diff)
working MSC nbs
Diffstat (limited to 'megapixels/notebooks/msc/test_plotly.ipynb')
-rw-r--r--megapixels/notebooks/msc/test_plotly.ipynb1185
1 files changed, 1185 insertions, 0 deletions
diff --git a/megapixels/notebooks/msc/test_plotly.ipynb b/megapixels/notebooks/msc/test_plotly.ipynb
new file mode 100644
index 00000000..b12cb142
--- /dev/null
+++ b/megapixels/notebooks/msc/test_plotly.ipynb
@@ -0,0 +1,1185 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Test Plotly"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Demo"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from plotly.offline import iplot, init_notebook_mode\n",
+ "import plotly.graph_objs as go\n",
+ "import plotly.io as pio\n",
+ "\n",
+ "import os\n",
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ " <script type=\"text/javascript\">\n",
+ " window.PlotlyConfig = {MathJaxConfig: 'local'};\n",
+ " if (window.MathJax) {MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}\n",
+ " if (typeof require !== 'undefined') {\n",
+ " require.undef(\"plotly\");\n",
+ " requirejs.config({\n",
+ " paths: {\n",
+ " 'plotly': ['https://cdn.plot.ly/plotly-latest.min']\n",
+ " }\n",
+ " });\n",
+ " require(['plotly'], function(Plotly) {\n",
+ " window._Plotly = Plotly;\n",
+ " });\n",
+ " }\n",
+ " </script>\n",
+ " "
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "init_notebook_mode(connected=True)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "config": {
+ "linkText": "Export to plot.ly",
+ "plotlyServerURL": "https://plot.ly",
+ "showLink": false
+ },
+ "data": [
+ {
+ "marker": {
+ "color": [
+ 0.6293828317071586,
+ 0.10871757916572877,
+ 0.68311690821298,
+ 0.9868548358867593,
+ 0.9356744842281925,
+ 0.9790537247648904,
+ 0.3258180192640453,
+ 0.12391204805045775,
+ 0.8350240537325824,
+ 0.5369662542168598,
+ 0.5431266213529744,
+ 0.629752855978358,
+ 0.3057523930457775,
+ 0.4585071756146928,
+ 0.4311862805765245,
+ 0.1639356212211679,
+ 0.446932803456484,
+ 0.8627171610367412,
+ 0.31518503849660306,
+ 0.5828651428770285,
+ 0.16001292379812304,
+ 0.6404620711754383,
+ 0.04741420092894122,
+ 0.7548488102472397,
+ 0.7353917005000188,
+ 0.4365025633180786,
+ 0.7839680628427522,
+ 0.6805068448092968,
+ 0.8786650700491208,
+ 0.06815397986979765,
+ 0.13535861871332966,
+ 0.9405516184122458,
+ 0.5437457047334291,
+ 0.5903552132029327,
+ 0.08082046350853744,
+ 0.7150168555710725,
+ 0.986232841445708,
+ 0.22817216482783065,
+ 0.1076811040405542,
+ 0.03804473076715431,
+ 0.7114105985548173,
+ 0.2836183570437315,
+ 0.48931430431938294,
+ 0.8365056267736387,
+ 0.6336230935293655,
+ 0.42541724288711247,
+ 0.8350608664218104,
+ 0.3437171780503755,
+ 0.14541534768179498,
+ 0.8787162108826218,
+ 0.025388796870841612,
+ 0.8111658156200445,
+ 0.018717505457894856,
+ 0.09869141356496391,
+ 0.3921323585962584,
+ 0.7132961159828939,
+ 0.7318985696655684,
+ 0.7869866024773561,
+ 0.7814016135827416,
+ 0.8919231750596648,
+ 0.28134414473838654,
+ 0.7237985608111946,
+ 0.3618380000508312,
+ 0.21075045827522243,
+ 0.9628478800749577,
+ 0.2900164358629147,
+ 0.4719721918840184,
+ 0.730285844834199,
+ 0.3942587955050557,
+ 0.32586005977792476,
+ 0.972528200795633,
+ 0.28025465435145835,
+ 0.627325945653425,
+ 0.015008746790136196,
+ 0.14237643495137675,
+ 0.050423801719477024,
+ 0.7644515022481213,
+ 0.6091667909932688,
+ 0.3532180131753364,
+ 0.8947334942638786,
+ 0.17387126634230343,
+ 0.5365981953906036,
+ 0.6889435903426656,
+ 0.6610488816804185,
+ 0.9749955651002764,
+ 0.9153566282398699,
+ 0.5269574781630024,
+ 0.8778260007512473,
+ 0.38075994993668905,
+ 0.5647499579658595,
+ 0.418283999093396,
+ 0.3579478941888037,
+ 0.3683880455143794,
+ 0.5201946750419136,
+ 0.2613710707351792,
+ 0.7122574990933892,
+ 0.7298329578282315,
+ 0.6379701686824202,
+ 0.7955868217388932,
+ 0.8163554813378757
+ ],
+ "colorscale": "Viridis",
+ "opacity": 0.6,
+ "size": [
+ 24.74150982375718,
+ 9.280421122552907,
+ 26.816266625639166,
+ 21.865635610789628,
+ 9.896893758182372,
+ 16.35959442725846,
+ 8.829943498152526,
+ 0.9561123550614292,
+ 28.59004398713737,
+ 27.998199247555412,
+ 14.356889793713542,
+ 12.510426498329961,
+ 27.948307057731554,
+ 11.443238859469622,
+ 24.66171987028657,
+ 22.666387218267374,
+ 23.462946003027827,
+ 25.451904787389697,
+ 20.081426958372838,
+ 27.524084273181675,
+ 25.744255659997357,
+ 21.31770690742058,
+ 13.630541365724554,
+ 27.44821596665852,
+ 14.931786869286563,
+ 2.2744366430542327,
+ 18.763621500539017,
+ 3.1819261762898976,
+ 4.610566148833989,
+ 4.149555285846313,
+ 16.482766212514964,
+ 22.717148416863015,
+ 24.987016922679274,
+ 12.528071041169763,
+ 28.274788722893614,
+ 11.081662434254852,
+ 28.44502729834879,
+ 19.51774621900454,
+ 19.644621049552086,
+ 18.770275237826883,
+ 5.079208459129881,
+ 26.875559773109472,
+ 14.291584841429627,
+ 13.314356351751613,
+ 1.5983548469032782,
+ 14.16205944182201,
+ 8.747779265393547,
+ 28.599356582105003,
+ 20.770844383653493,
+ 27.401053695841284,
+ 7.4552367973015485,
+ 18.184112831044487,
+ 21.200618948493563,
+ 19.54919647302541,
+ 26.410627753123226,
+ 0.6118250572534734,
+ 5.081967556847226,
+ 3.3611994256358946,
+ 3.807649332865587,
+ 19.531242703961418,
+ 28.408475476902236,
+ 19.03144105102476,
+ 27.392315621828345,
+ 20.95163521304236,
+ 12.649562527197713,
+ 20.94051863733014,
+ 18.551288851142925,
+ 24.26238241654025,
+ 1.067395868930422,
+ 18.027988539967136,
+ 17.577785181369727,
+ 12.21459774932675,
+ 21.54905183176187,
+ 14.025431326739437,
+ 7.948668233800754,
+ 14.247241180900321,
+ 19.370209208556346,
+ 20.08639665675465,
+ 0.3473738459998921,
+ 18.552605009050048,
+ 5.795867754824368,
+ 29.377512330217755,
+ 17.0977961534976,
+ 19.307556831117715,
+ 24.568224556315844,
+ 4.464096834419008,
+ 21.71654353183601,
+ 17.986786244282424,
+ 9.036785758979,
+ 11.467541197408401,
+ 15.506290662937483,
+ 5.110861130635449,
+ 20.044649489346963,
+ 9.172913083241099,
+ 17.742661485893773,
+ 16.10358725512652,
+ 7.483809983245088,
+ 4.193841641578638,
+ 11.161330279964542,
+ 10.132821938779692
+ ]
+ },
+ "mode": "markers",
+ "type": "scatter",
+ "uid": "b0b4b3e6-d74e-4596-b1f6-866494f66ac5",
+ "x": [
+ 0.9107379187961171,
+ 0.13830019680520433,
+ 0.821736889714595,
+ 0.3921878219656484,
+ 0.8346405307202264,
+ 0.9553493281777037,
+ 0.5917624120848792,
+ 0.7696872135096617,
+ 0.2764705214251728,
+ 0.10250747898818846,
+ 0.5608219612948858,
+ 0.009301052946640631,
+ 0.2888044375300247,
+ 0.08732715334107588,
+ 0.9218542459508559,
+ 0.7490711090144354,
+ 0.12087960522666752,
+ 0.7255816390705573,
+ 0.40455316553437204,
+ 0.1998318088429799,
+ 0.8563460736962455,
+ 0.24026621118853997,
+ 0.6779207634000527,
+ 0.6237494872918712,
+ 0.5690422866216804,
+ 0.14672189332739916,
+ 0.8283514372957037,
+ 0.3568733435451711,
+ 0.7623487473898288,
+ 0.07834607319110698,
+ 0.6657053354636957,
+ 0.8182792779517071,
+ 0.5514257159258872,
+ 0.11066849699793302,
+ 0.5473351302168906,
+ 0.8948668458488195,
+ 0.19414716791933673,
+ 0.30323631629795966,
+ 0.04384302355313652,
+ 0.9303407902908601,
+ 0.2522389366153581,
+ 0.5728123808665866,
+ 0.45937696306834785,
+ 0.2757418052570424,
+ 0.2161959559781027,
+ 0.7747543804280251,
+ 0.19915143297924554,
+ 0.11283247029514198,
+ 0.7762917205025742,
+ 0.3162146200663585,
+ 0.4010503767685871,
+ 0.9355531154171876,
+ 0.09986423597795058,
+ 0.4205367725458332,
+ 0.8866456464818482,
+ 0.6198436181367285,
+ 0.5728557391504273,
+ 0.13642060186522464,
+ 0.19927373777752855,
+ 0.05529450095070232,
+ 0.5680820939833129,
+ 0.5540148486363582,
+ 0.771675176030235,
+ 0.6796680014132509,
+ 0.7106838708683741,
+ 0.9896470266638204,
+ 0.2674939931440279,
+ 0.628205650589996,
+ 0.3444040914427221,
+ 0.39550692697500456,
+ 0.7288884851078544,
+ 0.7085878319736025,
+ 0.6552251619832516,
+ 0.7257098026671255,
+ 0.7996458911486881,
+ 0.8086747478773577,
+ 0.6457862802781831,
+ 0.4805442464646371,
+ 0.06430022279946768,
+ 0.7075285734743578,
+ 0.41260624418349545,
+ 0.7314891410155159,
+ 0.23410127672814485,
+ 0.40118352223110276,
+ 0.5785612386470048,
+ 0.4024214975652409,
+ 0.5713041888957858,
+ 0.17652943450758374,
+ 0.9238132184426326,
+ 0.3952167234942614,
+ 0.053536913771633166,
+ 0.16268009129180894,
+ 0.7356926845628389,
+ 0.2669795658555745,
+ 0.9789436295229189,
+ 0.19491540477894964,
+ 0.6068433581142664,
+ 0.028108521660386243,
+ 0.5365044995026428,
+ 0.5214889392986901
+ ],
+ "y": [
+ 0.4873970177492336,
+ 0.03520135403268476,
+ 0.15372421192191132,
+ 0.11747289197419675,
+ 0.25929344871317506,
+ 0.9343154176576614,
+ 0.23290384745041115,
+ 0.8076080396213733,
+ 0.7146438501495851,
+ 0.36975819935411935,
+ 0.0870746091896345,
+ 0.8008134269597948,
+ 0.8475447433102793,
+ 0.4923450072186961,
+ 0.9242116623604295,
+ 0.8436528492949156,
+ 0.4541422408475154,
+ 0.015582361403692735,
+ 0.21977327990438322,
+ 0.868154180660819,
+ 0.8843432948546245,
+ 0.14370992703672447,
+ 0.9913364257956125,
+ 0.46232751503686154,
+ 0.20524933850363802,
+ 0.8650688219937122,
+ 0.32908578899049623,
+ 0.012218730313331871,
+ 0.05010744587850702,
+ 0.07785971418825066,
+ 0.1733171340497437,
+ 0.5808155787065341,
+ 0.9520204587697467,
+ 0.4647336539079364,
+ 0.86816473027919,
+ 0.6122661358743096,
+ 0.8404187829047086,
+ 0.37147145579434915,
+ 0.08321713328355973,
+ 0.6586943244207204,
+ 0.602407140437571,
+ 0.2235583151695527,
+ 0.763975477157094,
+ 0.3142008713658715,
+ 0.9892757935382203,
+ 0.5557493623729575,
+ 0.3164295792273947,
+ 0.14059309260038433,
+ 0.8344983119977883,
+ 0.6887912143356906,
+ 0.1611436831893751,
+ 0.05897402479010627,
+ 0.003373454578108892,
+ 0.006539895146632224,
+ 0.7903140297989631,
+ 0.6311787683548261,
+ 0.1172803150406797,
+ 0.45702756110960463,
+ 0.6876320066897875,
+ 0.06217883327048679,
+ 0.9150508181601353,
+ 0.7869319414443614,
+ 0.43316746441311127,
+ 0.8274827883571912,
+ 0.4858941331954577,
+ 0.02735879076293446,
+ 0.6909308744595408,
+ 0.16557108650734542,
+ 0.22845795952243486,
+ 0.09676634978854826,
+ 0.09194657186854938,
+ 0.09298696272893658,
+ 0.6005778905754431,
+ 0.5929742222488289,
+ 0.14320148688584555,
+ 0.5390250901251392,
+ 0.2944532751258836,
+ 0.28996575786723555,
+ 0.1392237190849983,
+ 0.7640881096089533,
+ 0.6181357873580661,
+ 0.6044460143386351,
+ 0.1416927141729023,
+ 0.9391850654064762,
+ 0.19425081957087342,
+ 0.5560564633922214,
+ 0.07036763010665592,
+ 0.6031621225765096,
+ 0.26627800799541,
+ 0.5041808870007972,
+ 0.9136777914086817,
+ 0.26669225030370547,
+ 0.7024233423552112,
+ 0.4318747448478185,
+ 0.5386857478611576,
+ 0.18997125849911767,
+ 0.45147057964560544,
+ 0.36864502867926696,
+ 0.3566839665504429,
+ 0.9573684494139385
+ ]
+ }
+ ],
+ "layout": {}
+ },
+ "text/html": [
+ "<div>\n",
+ " \n",
+ " \n",
+ " <div id=\"3100d9be-f563-49b0-9aac-820b17e72a92\" class=\"plotly-graph-div\" style=\"height:525px; width:100%;\"></div>\n",
+ " <script type=\"text/javascript\">\n",
+ " require([\"plotly\"], function(Plotly) {\n",
+ " window.PLOTLYENV=window.PLOTLYENV || {};\n",
+ " window.PLOTLYENV.BASE_URL='https://plot.ly';\n",
+ " \n",
+ " if (document.getElementById(\"3100d9be-f563-49b0-9aac-820b17e72a92\")) {\n",
+ " Plotly.newPlot(\n",
+ " '3100d9be-f563-49b0-9aac-820b17e72a92',\n",
+ " [{\"marker\": {\"color\": [0.6293828317071586, 0.10871757916572877, 0.68311690821298, 0.9868548358867593, 0.9356744842281925, 0.9790537247648904, 0.3258180192640453, 0.12391204805045775, 0.8350240537325824, 0.5369662542168598, 0.5431266213529744, 0.629752855978358, 0.3057523930457775, 0.4585071756146928, 0.4311862805765245, 0.1639356212211679, 0.446932803456484, 0.8627171610367412, 0.31518503849660306, 0.5828651428770285, 0.16001292379812304, 0.6404620711754383, 0.04741420092894122, 0.7548488102472397, 0.7353917005000188, 0.4365025633180786, 0.7839680628427522, 0.6805068448092968, 0.8786650700491208, 0.06815397986979765, 0.13535861871332966, 0.9405516184122458, 0.5437457047334291, 0.5903552132029327, 0.08082046350853744, 0.7150168555710725, 0.986232841445708, 0.22817216482783065, 0.1076811040405542, 0.03804473076715431, 0.7114105985548173, 0.2836183570437315, 0.48931430431938294, 0.8365056267736387, 0.6336230935293655, 0.42541724288711247, 0.8350608664218104, 0.3437171780503755, 0.14541534768179498, 0.8787162108826218, 0.025388796870841612, 0.8111658156200445, 0.018717505457894856, 0.09869141356496391, 0.3921323585962584, 0.7132961159828939, 0.7318985696655684, 0.7869866024773561, 0.7814016135827416, 0.8919231750596648, 0.28134414473838654, 0.7237985608111946, 0.3618380000508312, 0.21075045827522243, 0.9628478800749577, 0.2900164358629147, 0.4719721918840184, 0.730285844834199, 0.3942587955050557, 0.32586005977792476, 0.972528200795633, 0.28025465435145835, 0.627325945653425, 0.015008746790136196, 0.14237643495137675, 0.050423801719477024, 0.7644515022481213, 0.6091667909932688, 0.3532180131753364, 0.8947334942638786, 0.17387126634230343, 0.5365981953906036, 0.6889435903426656, 0.6610488816804185, 0.9749955651002764, 0.9153566282398699, 0.5269574781630024, 0.8778260007512473, 0.38075994993668905, 0.5647499579658595, 0.418283999093396, 0.3579478941888037, 0.3683880455143794, 0.5201946750419136, 0.2613710707351792, 0.7122574990933892, 0.7298329578282315, 0.6379701686824202, 0.7955868217388932, 0.8163554813378757], \"colorscale\": \"Viridis\", \"opacity\": 0.6, \"size\": [24.74150982375718, 9.280421122552907, 26.816266625639166, 21.865635610789628, 9.896893758182372, 16.35959442725846, 8.829943498152526, 0.9561123550614292, 28.59004398713737, 27.998199247555412, 14.356889793713542, 12.510426498329961, 27.948307057731554, 11.443238859469622, 24.66171987028657, 22.666387218267374, 23.462946003027827, 25.451904787389697, 20.081426958372838, 27.524084273181675, 25.744255659997357, 21.31770690742058, 13.630541365724554, 27.44821596665852, 14.931786869286563, 2.2744366430542327, 18.763621500539017, 3.1819261762898976, 4.610566148833989, 4.149555285846313, 16.482766212514964, 22.717148416863015, 24.987016922679274, 12.528071041169763, 28.274788722893614, 11.081662434254852, 28.44502729834879, 19.51774621900454, 19.644621049552086, 18.770275237826883, 5.079208459129881, 26.875559773109472, 14.291584841429627, 13.314356351751613, 1.5983548469032782, 14.16205944182201, 8.747779265393547, 28.599356582105003, 20.770844383653493, 27.401053695841284, 7.4552367973015485, 18.184112831044487, 21.200618948493563, 19.54919647302541, 26.410627753123226, 0.6118250572534734, 5.081967556847226, 3.3611994256358946, 3.807649332865587, 19.531242703961418, 28.408475476902236, 19.03144105102476, 27.392315621828345, 20.95163521304236, 12.649562527197713, 20.94051863733014, 18.551288851142925, 24.26238241654025, 1.067395868930422, 18.027988539967136, 17.577785181369727, 12.21459774932675, 21.54905183176187, 14.025431326739437, 7.948668233800754, 14.247241180900321, 19.370209208556346, 20.08639665675465, 0.3473738459998921, 18.552605009050048, 5.795867754824368, 29.377512330217755, 17.0977961534976, 19.307556831117715, 24.568224556315844, 4.464096834419008, 21.71654353183601, 17.986786244282424, 9.036785758979, 11.467541197408401, 15.506290662937483, 5.110861130635449, 20.044649489346963, 9.172913083241099, 17.742661485893773, 16.10358725512652, 7.483809983245088, 4.193841641578638, 11.161330279964542, 10.132821938779692]}, \"mode\": \"markers\", \"type\": \"scatter\", \"uid\": \"b0b4b3e6-d74e-4596-b1f6-866494f66ac5\", \"x\": [0.9107379187961171, 0.13830019680520433, 0.821736889714595, 0.3921878219656484, 0.8346405307202264, 0.9553493281777037, 0.5917624120848792, 0.7696872135096617, 0.2764705214251728, 0.10250747898818846, 0.5608219612948858, 0.009301052946640631, 0.2888044375300247, 0.08732715334107588, 0.9218542459508559, 0.7490711090144354, 0.12087960522666752, 0.7255816390705573, 0.40455316553437204, 0.1998318088429799, 0.8563460736962455, 0.24026621118853997, 0.6779207634000527, 0.6237494872918712, 0.5690422866216804, 0.14672189332739916, 0.8283514372957037, 0.3568733435451711, 0.7623487473898288, 0.07834607319110698, 0.6657053354636957, 0.8182792779517071, 0.5514257159258872, 0.11066849699793302, 0.5473351302168906, 0.8948668458488195, 0.19414716791933673, 0.30323631629795966, 0.04384302355313652, 0.9303407902908601, 0.2522389366153581, 0.5728123808665866, 0.45937696306834785, 0.2757418052570424, 0.2161959559781027, 0.7747543804280251, 0.19915143297924554, 0.11283247029514198, 0.7762917205025742, 0.3162146200663585, 0.4010503767685871, 0.9355531154171876, 0.09986423597795058, 0.4205367725458332, 0.8866456464818482, 0.6198436181367285, 0.5728557391504273, 0.13642060186522464, 0.19927373777752855, 0.05529450095070232, 0.5680820939833129, 0.5540148486363582, 0.771675176030235, 0.6796680014132509, 0.7106838708683741, 0.9896470266638204, 0.2674939931440279, 0.628205650589996, 0.3444040914427221, 0.39550692697500456, 0.7288884851078544, 0.7085878319736025, 0.6552251619832516, 0.7257098026671255, 0.7996458911486881, 0.8086747478773577, 0.6457862802781831, 0.4805442464646371, 0.06430022279946768, 0.7075285734743578, 0.41260624418349545, 0.7314891410155159, 0.23410127672814485, 0.40118352223110276, 0.5785612386470048, 0.4024214975652409, 0.5713041888957858, 0.17652943450758374, 0.9238132184426326, 0.3952167234942614, 0.053536913771633166, 0.16268009129180894, 0.7356926845628389, 0.2669795658555745, 0.9789436295229189, 0.19491540477894964, 0.6068433581142664, 0.028108521660386243, 0.5365044995026428, 0.5214889392986901], \"y\": [0.4873970177492336, 0.03520135403268476, 0.15372421192191132, 0.11747289197419675, 0.25929344871317506, 0.9343154176576614, 0.23290384745041115, 0.8076080396213733, 0.7146438501495851, 0.36975819935411935, 0.0870746091896345, 0.8008134269597948, 0.8475447433102793, 0.4923450072186961, 0.9242116623604295, 0.8436528492949156, 0.4541422408475154, 0.015582361403692735, 0.21977327990438322, 0.868154180660819, 0.8843432948546245, 0.14370992703672447, 0.9913364257956125, 0.46232751503686154, 0.20524933850363802, 0.8650688219937122, 0.32908578899049623, 0.012218730313331871, 0.05010744587850702, 0.07785971418825066, 0.1733171340497437, 0.5808155787065341, 0.9520204587697467, 0.4647336539079364, 0.86816473027919, 0.6122661358743096, 0.8404187829047086, 0.37147145579434915, 0.08321713328355973, 0.6586943244207204, 0.602407140437571, 0.2235583151695527, 0.763975477157094, 0.3142008713658715, 0.9892757935382203, 0.5557493623729575, 0.3164295792273947, 0.14059309260038433, 0.8344983119977883, 0.6887912143356906, 0.1611436831893751, 0.05897402479010627, 0.003373454578108892, 0.006539895146632224, 0.7903140297989631, 0.6311787683548261, 0.1172803150406797, 0.45702756110960463, 0.6876320066897875, 0.06217883327048679, 0.9150508181601353, 0.7869319414443614, 0.43316746441311127, 0.8274827883571912, 0.4858941331954577, 0.02735879076293446, 0.6909308744595408, 0.16557108650734542, 0.22845795952243486, 0.09676634978854826, 0.09194657186854938, 0.09298696272893658, 0.6005778905754431, 0.5929742222488289, 0.14320148688584555, 0.5390250901251392, 0.2944532751258836, 0.28996575786723555, 0.1392237190849983, 0.7640881096089533, 0.6181357873580661, 0.6044460143386351, 0.1416927141729023, 0.9391850654064762, 0.19425081957087342, 0.5560564633922214, 0.07036763010665592, 0.6031621225765096, 0.26627800799541, 0.5041808870007972, 0.9136777914086817, 0.26669225030370547, 0.7024233423552112, 0.4318747448478185, 0.5386857478611576, 0.18997125849911767, 0.45147057964560544, 0.36864502867926696, 0.3566839665504429, 0.9573684494139385]}],\n",
+ " {},\n",
+ " {\"showLink\": false, \"linkText\": \"Export to plot.ly\", \"plotlyServerURL\": \"https://plot.ly\", \"responsive\": true}\n",
+ " ).then(function(){\n",
+ " \n",
+ "var gd = document.getElementById('3100d9be-f563-49b0-9aac-820b17e72a92');\n",
+ "var x = new MutationObserver(function (mutations, observer) {{\n",
+ " var display = window.getComputedStyle(gd).display;\n",
+ " if (!display || display === 'none') {{\n",
+ " console.log([gd, 'removed!']);\n",
+ " Plotly.purge(gd);\n",
+ " observer.disconnect();\n",
+ " }}\n",
+ "}});\n",
+ "\n",
+ "// Listen for the removal of the full notebook cells\n",
+ "var notebookContainer = gd.closest('#notebook-container');\n",
+ "if (notebookContainer) {{\n",
+ " x.observe(notebookContainer, {childList: true});\n",
+ "}}\n",
+ "\n",
+ "// Listen for the clearing of the current output cell\n",
+ "var outputEl = gd.closest('.output');\n",
+ "if (outputEl) {{\n",
+ " x.observe(outputEl, {childList: true});\n",
+ "}}\n",
+ "\n",
+ " })\n",
+ " };\n",
+ " });\n",
+ " </script>\n",
+ " </div>"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "N = 100\n",
+ "x = np.random.rand(N)\n",
+ "y = np.random.rand(N)\n",
+ "colors = np.random.rand(N)\n",
+ "sz = np.random.rand(N)*30\n",
+ "\n",
+ "fig = go.Figure()\n",
+ "fig.add_scatter(x=x,\n",
+ " y=y,\n",
+ " mode='markers',\n",
+ " marker={'size': sz,\n",
+ " 'color': colors,\n",
+ " 'opacity': 0.6,\n",
+ " 'colorscale': 'Viridis'\n",
+ " });\n",
+ "iplot(fig)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "if not os.path.exists('images'):\n",
+ " os.mkdir('images')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import psutil"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "pio.write_image(fig, 'images/fig1.png')"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Pie Chart"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "config": {
+ "linkText": "Export to plot.ly",
+ "plotlyServerURL": "https://plot.ly",
+ "showLink": false
+ },
+ "data": [
+ {
+ "mode": "markers",
+ "name": "2007",
+ "text": [
+ "Afghanistan",
+ "Albania",
+ "Algeria",
+ "Angola",
+ "Argentina",
+ "Australia",
+ "Austria",
+ "Bahrain",
+ "Bangladesh",
+ "Belgium",
+ "Benin",
+ "Bolivia",
+ "Bosnia and Herzegovina",
+ "Botswana",
+ "Brazil",
+ "Bulgaria",
+ "Burkina Faso",
+ "Burundi",
+ "Cambodia",
+ "Cameroon",
+ "Canada",
+ "Central African Republic",
+ "Chad",
+ "Chile",
+ "China",
+ "Colombia",
+ "Comoros",
+ "Congo, Dem. Rep.",
+ "Congo, Rep.",
+ "Costa Rica",
+ "Cote d'Ivoire",
+ "Croatia",
+ "Cuba",
+ "Czech Republic",
+ "Denmark",
+ "Djibouti",
+ "Dominican Republic",
+ "Ecuador",
+ "Egypt",
+ "El Salvador",
+ "Equatorial Guinea",
+ "Eritrea",
+ "Ethiopia",
+ "Finland",
+ "France",
+ "Gabon",
+ "Gambia",
+ "Germany",
+ "Ghana",
+ "Greece",
+ "Guatemala",
+ "Guinea",
+ "Guinea-Bissau",
+ "Haiti",
+ "Honduras",
+ "Hong Kong, China",
+ "Hungary",
+ "Iceland",
+ "India",
+ "Indonesia",
+ "Iran",
+ "Iraq",
+ "Ireland",
+ "Israel",
+ "Italy",
+ "Jamaica",
+ "Japan",
+ "Jordan",
+ "Kenya",
+ "Korea, Dem. Rep.",
+ "Korea, Rep.",
+ "Kuwait",
+ "Lebanon",
+ "Lesotho",
+ "Liberia",
+ "Libya",
+ "Madagascar",
+ "Malawi",
+ "Malaysia",
+ "Mali",
+ "Mauritania",
+ "Mauritius",
+ "Mexico",
+ "Mongolia",
+ "Montenegro",
+ "Morocco",
+ "Mozambique",
+ "Myanmar",
+ "Namibia",
+ "Nepal",
+ "Netherlands",
+ "New Zealand",
+ "Nicaragua",
+ "Niger",
+ "Nigeria",
+ "Norway",
+ "Oman",
+ "Pakistan",
+ "Panama",
+ "Paraguay",
+ "Peru",
+ "Philippines",
+ "Poland",
+ "Portugal",
+ "Puerto Rico",
+ "Reunion",
+ "Romania",
+ "Rwanda",
+ "Sao Tome and Principe",
+ "Saudi Arabia",
+ "Senegal",
+ "Serbia",
+ "Sierra Leone",
+ "Singapore",
+ "Slovak Republic",
+ "Slovenia",
+ "Somalia",
+ "South Africa",
+ "Spain",
+ "Sri Lanka",
+ "Sudan",
+ "Swaziland",
+ "Sweden",
+ "Switzerland",
+ "Syria",
+ "Taiwan",
+ "Tanzania",
+ "Thailand",
+ "Togo",
+ "Trinidad and Tobago",
+ "Tunisia",
+ "Turkey",
+ "Uganda",
+ "United Kingdom",
+ "United States",
+ "Uruguay",
+ "Venezuela",
+ "Vietnam",
+ "West Bank and Gaza",
+ "Yemen, Rep.",
+ "Zambia",
+ "Zimbabwe"
+ ],
+ "type": "scatter",
+ "uid": "869e7afa-226e-4a5a-9c86-17b8b0da2c40",
+ "x": [
+ 974.5803384,
+ 5937.029525999998,
+ 6223.367465,
+ 4797.231267,
+ 12779.37964,
+ 34435.367439999995,
+ 36126.4927,
+ 29796.04834,
+ 1391.253792,
+ 33692.60508,
+ 1441.284873,
+ 3822.137084,
+ 7446.298803,
+ 12569.85177,
+ 9065.800825,
+ 10680.79282,
+ 1217.032994,
+ 430.0706916,
+ 1713.778686,
+ 2042.09524,
+ 36319.23501,
+ 706.016537,
+ 1704.063724,
+ 13171.63885,
+ 4959.114854,
+ 7006.580419,
+ 986.1478792,
+ 277.5518587,
+ 3632.557798,
+ 9645.06142,
+ 1544.750112,
+ 14619.222719999998,
+ 8948.102923,
+ 22833.30851,
+ 35278.41874,
+ 2082.4815670000007,
+ 6025.3747520000015,
+ 6873.262326000001,
+ 5581.180998,
+ 5728.353514,
+ 12154.08975,
+ 641.3695236000002,
+ 690.8055759,
+ 33207.0844,
+ 30470.0167,
+ 13206.48452,
+ 752.7497265,
+ 32170.37442,
+ 1327.60891,
+ 27538.41188,
+ 5186.050003,
+ 942.6542111,
+ 579.2317429999998,
+ 1201.637154,
+ 3548.3308460000007,
+ 39724.97867,
+ 18008.94444,
+ 36180.78919,
+ 2452.210407,
+ 3540.651564,
+ 11605.71449,
+ 4471.061906,
+ 40675.99635,
+ 25523.2771,
+ 28569.7197,
+ 7320.8802620000015,
+ 31656.06806,
+ 4519.461171,
+ 1463.249282,
+ 1593.06548,
+ 23348.139730000006,
+ 47306.98978,
+ 10461.05868,
+ 1569.331442,
+ 414.5073415,
+ 12057.49928,
+ 1044.770126,
+ 759.3499101,
+ 12451.6558,
+ 1042.581557,
+ 1803.151496,
+ 10956.99112,
+ 11977.57496,
+ 3095.7722710000007,
+ 9253.896111,
+ 3820.17523,
+ 823.6856205,
+ 944,
+ 4811.060429,
+ 1091.359778,
+ 36797.93332,
+ 25185.00911,
+ 2749.320965,
+ 619.6768923999998,
+ 2013.977305,
+ 49357.19017,
+ 22316.19287,
+ 2605.94758,
+ 9809.185636,
+ 4172.838464,
+ 7408.905561,
+ 3190.481016,
+ 15389.924680000002,
+ 20509.64777,
+ 19328.70901,
+ 7670.122558,
+ 10808.47561,
+ 863.0884639000002,
+ 1598.435089,
+ 21654.83194,
+ 1712.472136,
+ 9786.534714,
+ 862.5407561000002,
+ 47143.17964,
+ 18678.31435,
+ 25768.25759,
+ 926.1410683,
+ 9269.657808,
+ 28821.0637,
+ 3970.095407,
+ 2602.394995,
+ 4513.480643,
+ 33859.74835,
+ 37506.41907,
+ 4184.548089,
+ 28718.27684,
+ 1107.482182,
+ 7458.396326999998,
+ 882.9699437999999,
+ 18008.50924,
+ 7092.923025,
+ 8458.276384,
+ 1056.380121,
+ 33203.26128,
+ 42951.65309,
+ 10611.46299,
+ 11415.80569,
+ 2441.576404,
+ 3025.349798,
+ 2280.769906,
+ 1271.211593,
+ 469.70929810000007
+ ],
+ "y": [
+ 43.828,
+ 76.423,
+ 72.301,
+ 42.731,
+ 75.32,
+ 81.235,
+ 79.829,
+ 75.635,
+ 64.062,
+ 79.441,
+ 56.728,
+ 65.554,
+ 74.852,
+ 50.728,
+ 72.39,
+ 73.005,
+ 52.295,
+ 49.58,
+ 59.723,
+ 50.43,
+ 80.653,
+ 44.74100000000001,
+ 50.651,
+ 78.553,
+ 72.961,
+ 72.889,
+ 65.152,
+ 46.462,
+ 55.322,
+ 78.782,
+ 48.328,
+ 75.748,
+ 78.273,
+ 76.486,
+ 78.332,
+ 54.791,
+ 72.235,
+ 74.994,
+ 71.33800000000002,
+ 71.878,
+ 51.57899999999999,
+ 58.04,
+ 52.947,
+ 79.313,
+ 80.657,
+ 56.735,
+ 59.448,
+ 79.406,
+ 60.022,
+ 79.483,
+ 70.259,
+ 56.007,
+ 46.38800000000001,
+ 60.916,
+ 70.19800000000001,
+ 82.208,
+ 73.33800000000002,
+ 81.757,
+ 64.69800000000001,
+ 70.65,
+ 70.964,
+ 59.545,
+ 78.885,
+ 80.745,
+ 80.546,
+ 72.567,
+ 82.603,
+ 72.535,
+ 54.11,
+ 67.297,
+ 78.623,
+ 77.58800000000002,
+ 71.993,
+ 42.592,
+ 45.678,
+ 73.952,
+ 59.44300000000001,
+ 48.303,
+ 74.241,
+ 54.467,
+ 64.164,
+ 72.801,
+ 76.195,
+ 66.803,
+ 74.543,
+ 71.164,
+ 42.082,
+ 62.069,
+ 52.90600000000001,
+ 63.785,
+ 79.762,
+ 80.204,
+ 72.899,
+ 56.867,
+ 46.859,
+ 80.196,
+ 75.64,
+ 65.483,
+ 75.53699999999998,
+ 71.752,
+ 71.421,
+ 71.688,
+ 75.563,
+ 78.098,
+ 78.74600000000002,
+ 76.442,
+ 72.476,
+ 46.242,
+ 65.528,
+ 72.777,
+ 63.062,
+ 74.002,
+ 42.56800000000001,
+ 79.972,
+ 74.663,
+ 77.926,
+ 48.159,
+ 49.339,
+ 80.941,
+ 72.396,
+ 58.556,
+ 39.613,
+ 80.884,
+ 81.70100000000002,
+ 74.143,
+ 78.4,
+ 52.517,
+ 70.616,
+ 58.42,
+ 69.819,
+ 73.923,
+ 71.777,
+ 51.542,
+ 79.425,
+ 78.242,
+ 76.384,
+ 73.747,
+ 74.249,
+ 73.422,
+ 62.698,
+ 42.38399999999999,
+ 43.487
+ ]
+ }
+ ],
+ "layout": {
+ "xaxis": {
+ "title": {
+ "text": "GDP per Capita"
+ },
+ "type": "log"
+ },
+ "yaxis": {
+ "title": {
+ "text": "Life Expectancy"
+ }
+ }
+ }
+ },
+ "text/html": [
+ "<div>\n",
+ " \n",
+ " \n",
+ " <div id=\"765766e4-5bc8-490f-8488-467ecfef833c\" class=\"plotly-graph-div\" style=\"height:525px; width:100%;\"></div>\n",
+ " <script type=\"text/javascript\">\n",
+ " require([\"plotly\"], function(Plotly) {\n",
+ " window.PLOTLYENV=window.PLOTLYENV || {};\n",
+ " window.PLOTLYENV.BASE_URL='https://plot.ly';\n",
+ " \n",
+ " if (document.getElementById(\"765766e4-5bc8-490f-8488-467ecfef833c\")) {\n",
+ " Plotly.newPlot(\n",
+ " '765766e4-5bc8-490f-8488-467ecfef833c',\n",
+ " [{\"mode\": \"markers\", \"name\": \"2007\", \"text\": [\"Afghanistan\", \"Albania\", \"Algeria\", \"Angola\", \"Argentina\", \"Australia\", \"Austria\", \"Bahrain\", \"Bangladesh\", \"Belgium\", \"Benin\", \"Bolivia\", \"Bosnia and Herzegovina\", \"Botswana\", \"Brazil\", \"Bulgaria\", \"Burkina Faso\", \"Burundi\", \"Cambodia\", \"Cameroon\", \"Canada\", \"Central African Republic\", \"Chad\", \"Chile\", \"China\", \"Colombia\", \"Comoros\", \"Congo, Dem. Rep.\", \"Congo, Rep.\", \"Costa Rica\", \"Cote d'Ivoire\", \"Croatia\", \"Cuba\", \"Czech Republic\", \"Denmark\", \"Djibouti\", \"Dominican Republic\", \"Ecuador\", \"Egypt\", \"El Salvador\", \"Equatorial Guinea\", \"Eritrea\", \"Ethiopia\", \"Finland\", \"France\", \"Gabon\", \"Gambia\", \"Germany\", \"Ghana\", \"Greece\", \"Guatemala\", \"Guinea\", \"Guinea-Bissau\", \"Haiti\", \"Honduras\", \"Hong Kong, China\", \"Hungary\", \"Iceland\", \"India\", \"Indonesia\", \"Iran\", \"Iraq\", \"Ireland\", \"Israel\", \"Italy\", \"Jamaica\", \"Japan\", \"Jordan\", \"Kenya\", \"Korea, Dem. Rep.\", \"Korea, Rep.\", \"Kuwait\", \"Lebanon\", \"Lesotho\", \"Liberia\", \"Libya\", \"Madagascar\", \"Malawi\", \"Malaysia\", \"Mali\", \"Mauritania\", \"Mauritius\", \"Mexico\", \"Mongolia\", \"Montenegro\", \"Morocco\", \"Mozambique\", \"Myanmar\", \"Namibia\", \"Nepal\", \"Netherlands\", \"New Zealand\", \"Nicaragua\", \"Niger\", \"Nigeria\", \"Norway\", \"Oman\", \"Pakistan\", \"Panama\", \"Paraguay\", \"Peru\", \"Philippines\", \"Poland\", \"Portugal\", \"Puerto Rico\", \"Reunion\", \"Romania\", \"Rwanda\", \"Sao Tome and Principe\", \"Saudi Arabia\", \"Senegal\", \"Serbia\", \"Sierra Leone\", \"Singapore\", \"Slovak Republic\", \"Slovenia\", \"Somalia\", \"South Africa\", \"Spain\", \"Sri Lanka\", \"Sudan\", \"Swaziland\", \"Sweden\", \"Switzerland\", \"Syria\", \"Taiwan\", \"Tanzania\", \"Thailand\", \"Togo\", \"Trinidad and Tobago\", \"Tunisia\", \"Turkey\", \"Uganda\", \"United Kingdom\", \"United States\", \"Uruguay\", \"Venezuela\", \"Vietnam\", \"West Bank and Gaza\", \"Yemen, Rep.\", \"Zambia\", \"Zimbabwe\"], \"type\": \"scatter\", \"uid\": \"869e7afa-226e-4a5a-9c86-17b8b0da2c40\", \"x\": [974.5803384, 5937.029525999998, 6223.367465, 4797.231267, 12779.37964, 34435.367439999995, 36126.4927, 29796.04834, 1391.253792, 33692.60508, 1441.284873, 3822.137084, 7446.298803, 12569.85177, 9065.800825, 10680.79282, 1217.032994, 430.0706916, 1713.778686, 2042.09524, 36319.23501, 706.016537, 1704.063724, 13171.63885, 4959.114854, 7006.580419, 986.1478792, 277.5518587, 3632.557798, 9645.06142, 1544.750112, 14619.222719999998, 8948.102923, 22833.30851, 35278.41874, 2082.4815670000007, 6025.3747520000015, 6873.262326000001, 5581.180998, 5728.353514, 12154.08975, 641.3695236000002, 690.8055759, 33207.0844, 30470.0167, 13206.48452, 752.7497265, 32170.37442, 1327.60891, 27538.41188, 5186.050003, 942.6542111, 579.2317429999998, 1201.637154, 3548.3308460000007, 39724.97867, 18008.94444, 36180.78919, 2452.210407, 3540.651564, 11605.71449, 4471.061906, 40675.99635, 25523.2771, 28569.7197, 7320.8802620000015, 31656.06806, 4519.461171, 1463.249282, 1593.06548, 23348.139730000006, 47306.98978, 10461.05868, 1569.331442, 414.5073415, 12057.49928, 1044.770126, 759.3499101, 12451.6558, 1042.581557, 1803.151496, 10956.99112, 11977.57496, 3095.7722710000007, 9253.896111, 3820.17523, 823.6856205, 944.0, 4811.060429, 1091.359778, 36797.93332, 25185.00911, 2749.320965, 619.6768923999998, 2013.977305, 49357.19017, 22316.19287, 2605.94758, 9809.185636, 4172.838464, 7408.905561, 3190.481016, 15389.924680000002, 20509.64777, 19328.70901, 7670.122558, 10808.47561, 863.0884639000002, 1598.435089, 21654.83194, 1712.472136, 9786.534714, 862.5407561000002, 47143.17964, 18678.31435, 25768.25759, 926.1410683, 9269.657808, 28821.0637, 3970.095407, 2602.394995, 4513.480643, 33859.74835, 37506.41907, 4184.548089, 28718.27684, 1107.482182, 7458.396326999998, 882.9699437999999, 18008.50924, 7092.923025, 8458.276384, 1056.380121, 33203.26128, 42951.65309, 10611.46299, 11415.80569, 2441.576404, 3025.349798, 2280.769906, 1271.211593, 469.70929810000007], \"y\": [43.828, 76.423, 72.301, 42.731, 75.32, 81.235, 79.829, 75.635, 64.062, 79.441, 56.728, 65.554, 74.852, 50.728, 72.39, 73.005, 52.295, 49.58, 59.723, 50.43, 80.653, 44.74100000000001, 50.651, 78.553, 72.961, 72.889, 65.152, 46.462, 55.322, 78.782, 48.328, 75.748, 78.273, 76.486, 78.332, 54.791, 72.235, 74.994, 71.33800000000002, 71.878, 51.57899999999999, 58.04, 52.947, 79.313, 80.657, 56.735, 59.448, 79.406, 60.022, 79.483, 70.259, 56.007, 46.38800000000001, 60.916, 70.19800000000001, 82.208, 73.33800000000002, 81.757, 64.69800000000001, 70.65, 70.964, 59.545, 78.885, 80.745, 80.546, 72.567, 82.603, 72.535, 54.11, 67.297, 78.623, 77.58800000000002, 71.993, 42.592, 45.678, 73.952, 59.44300000000001, 48.303, 74.241, 54.467, 64.164, 72.801, 76.195, 66.803, 74.543, 71.164, 42.082, 62.069, 52.90600000000001, 63.785, 79.762, 80.204, 72.899, 56.867, 46.859, 80.196, 75.64, 65.483, 75.53699999999998, 71.752, 71.421, 71.688, 75.563, 78.098, 78.74600000000002, 76.442, 72.476, 46.242, 65.528, 72.777, 63.062, 74.002, 42.56800000000001, 79.972, 74.663, 77.926, 48.159, 49.339, 80.941, 72.396, 58.556, 39.613, 80.884, 81.70100000000002, 74.143, 78.4, 52.517, 70.616, 58.42, 69.819, 73.923, 71.777, 51.542, 79.425, 78.242, 76.384, 73.747, 74.249, 73.422, 62.698, 42.38399999999999, 43.487]}],\n",
+ " {\"xaxis\": {\"title\": {\"text\": \"GDP per Capita\"}, \"type\": \"log\"}, \"yaxis\": {\"title\": {\"text\": \"Life Expectancy\"}}},\n",
+ " {\"showLink\": false, \"linkText\": \"Export to plot.ly\", \"plotlyServerURL\": \"https://plot.ly\", \"responsive\": true}\n",
+ " ).then(function(){\n",
+ " \n",
+ "var gd = document.getElementById('765766e4-5bc8-490f-8488-467ecfef833c');\n",
+ "var x = new MutationObserver(function (mutations, observer) {{\n",
+ " var display = window.getComputedStyle(gd).display;\n",
+ " if (!display || display === 'none') {{\n",
+ " console.log([gd, 'removed!']);\n",
+ " Plotly.purge(gd);\n",
+ " observer.disconnect();\n",
+ " }}\n",
+ "}});\n",
+ "\n",
+ "// Listen for the removal of the full notebook cells\n",
+ "var notebookContainer = gd.closest('#notebook-container');\n",
+ "if (notebookContainer) {{\n",
+ " x.observe(notebookContainer, {childList: true});\n",
+ "}}\n",
+ "\n",
+ "// Listen for the clearing of the current output cell\n",
+ "var outputEl = gd.closest('.output');\n",
+ "if (outputEl) {{\n",
+ " x.observe(outputEl, {childList: true});\n",
+ "}}\n",
+ "\n",
+ " })\n",
+ " };\n",
+ " });\n",
+ " </script>\n",
+ " </div>"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "import plotly.plotly as py\n",
+ "import plotly.graph_objs as go\n",
+ "import pandas as pd\n",
+ "\n",
+ "df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminder2007.csv')\n",
+ "\n",
+ "fig = {\n",
+ " 'data': [\n",
+ " {\n",
+ " 'x': df.gdpPercap, \n",
+ " 'y': df.lifeExp, \n",
+ " 'text': df.country, \n",
+ " 'mode': 'markers', \n",
+ " 'name': '2007'},\n",
+ " ],\n",
+ " 'layout': {\n",
+ " 'xaxis': {'title': 'GDP per Capita', 'type': 'log'},\n",
+ " 'yaxis': {'title': \"Life Expectancy\"}\n",
+ " }\n",
+ "}\n",
+ "\n",
+ "iplot(fig, filename='pandas-multiple-scatter')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "pio.write_image(fig, 'images/scatter.png')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "megapixels",
+ "language": "python",
+ "name": "megapixels"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.6.8"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}