Skip to content

Instantly share code, notes, and snippets.

@qzm
Created March 18, 2019 02:44
Show Gist options
  • Save qzm/d1a5548096e6386b16ecdd1635bd3c96 to your computer and use it in GitHub Desktop.
Save qzm/d1a5548096e6386b16ecdd1635bd3c96 to your computer and use it in GitHub Desktop.
example.ipynb
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"source": [
"# Time for Plotly in nteract!\n",
"\n",
"This is _also_ a demonstration of custom mimetypes with nteract. Woo!\n"
],
"metadata": {}
},
{
"cell_type": "code",
"source": [
"import IPython\n",
"import plotly\n",
"import json\n",
"\n",
"def plotize(data, layout=None):\n",
" \"\"\"Plot with Plotly.js using the Plotly JSON Chart Schema\n",
" \n",
" http://help.plot.ly/json-chart-schema/\n",
" \"\"\"\n",
" if layout is None:\n",
" layout = {}\n",
" \n",
" redata = json.loads(json.dumps(data, cls=plotly.utils.PlotlyJSONEncoder))\n",
" relayout = json.loads(json.dumps(layout, cls=plotly.utils.PlotlyJSONEncoder))\n",
" \n",
" bundle = {}\n",
" bundle['application/vnd.plotly.v1+json'] = {\n",
" \t'data': redata,\n",
" 'layout': relayout,\n",
" }\n",
" \n",
" IPython.display.display(bundle, raw=True)"
],
"outputs": [],
"execution_count": 1,
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"source": [
"data = [\n",
" {'x': [1999, 2000, 2001, 2002], 'y': [10, 15, 13, 17], 'type': 'scatter'},\n",
" {'x': [1999, 2000, 2001, 2002], 'y': [16, 5, 11, 9], 'type': 'scatter'}\n",
"]\n",
"\n",
"layout = {\n",
" 'title': 'Sales Growth',\n",
" 'xaxis': { 'title': 'Year', 'showgrid': False, 'zeroline': False },\n",
" 'yaxis': { 'title': 'Percent', 'showline': False }\n",
"}"
],
"outputs": [],
"execution_count": 2,
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"source": [
"plotize(data, layout)"
],
"outputs": [
{
"output_type": "display_data",
"data": {
"application/vnd.plotly.v1+json": {
"data": [
{
"y": [
10,
15,
13,
17
],
"x": [
1999,
2000,
2001,
2002
],
"type": "scatter"
},
{
"y": [
16,
5,
11,
9
],
"x": [
1999,
2000,
2001,
2002
],
"type": "scatter"
}
],
"layout": {
"title": "Sales Growth",
"xaxis": {
"zeroline": false,
"title": "Year",
"showgrid": false
},
"yaxis": {
"showline": false,
"title": "Percent"
}
}
}
},
"metadata": {}
}
],
"execution_count": 3,
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"source": [
"import plotly.graph_objs as go\n",
"\n",
"# Create random data with numpy\n",
"import numpy as np\n",
"\n",
"N = 1000\n",
"random_x = np.random.randn(N)\n",
"random_y = np.random.randn(N)\n",
"\n",
"# Create a trace\n",
"trace = go.Scatter(\n",
" x = random_x,\n",
" y = random_y,\n",
" mode = 'markers'\n",
")\n",
"\ndata = [trace]"
],
"outputs": [],
"execution_count": 4,
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"source": [
"plotize(data)"
],
"outputs": [
{
"output_type": "display_data",
"data": {
"application/vnd.plotly.v1+json": {
"data": [
{
"y": [
-0.7760373534399171,
0.16662315991848223,
-0.871340943839701,
-0.7080751843855173,
-2.1402238737558217,
-0.8478214221236838,
-0.43117440395241946,
-1.0893987228562643,
0.08137742375910693,
-0.3778546347043816,
1.5933397034134174,
0.2901365737962463,
-0.1626859113555938,
-0.9416335946048218,
0.8152113057173414,
0.5096705410158177,
-0.20221607619429058,
-0.11502963566697899,
0.2843592402032953,
1.8111377974813148,
1.7984667533988246,
1.0156513413651374,
0.9909472317383652,
0.03332291692045246,
-0.19758804017782677,
-0.5370174071786802,
-0.051947639042550085,
0.3758545997053121,
0.8320384174209796,
-0.7558749138920352,
-0.8675229380380527,
0.4752652033475868,
0.3945940795627219,
0.009990476892040943,
-0.5633728957671003,
-0.6250819838020684,
0.36066452223507256,
-0.28139861788117887,
2.3539867651040365,
-1.1765169868417222,
0.6834668412917828,
1.0451805273818415,
-0.5835073599804026,
0.3482543889109109,
-0.5055372331975342,
-1.7457232946995127,
0.12382171654470633,
1.4374093620765664,
2.1908403001327046,
-0.052923621893274896,
1.7806216740962628,
-0.6262719809024695,
0.2670496594593716,
-2.091039522905753,
-0.3035378540122805,
0.5903968458619762,
-0.12993600434150526,
0.8446958611489976,
-0.9904180372904589,
-1.1084813408370109,
-0.13431411707132276,
-1.1865602209623787,
-0.942865255968461,
-0.985779472587865,
0.8637732646153936,
-0.14574201842457302,
-1.037331729314512,
-0.9338520279770551,
1.3972388298308933,
1.557347093166569,
-1.358922347958587,
-0.5738225626048967,
-0.1851175479327272,
-2.7308755751766802,
0.0007075425399371782,
0.2642509038600938,
-0.2514716141152398,
-0.08914178178567944,
-0.5444716372175274,
-2.8081696231440176,
-1.3482569160121476,
-1.1316220849448408,
1.296334533518823,
0.028782828547863386,
0.24138853441032157,
0.3386795934764439,
0.11204173812179553,
0.11572062031842568,
0.5953956753595887,
1.2626007294655721,
-1.2278237932935898,
-2.4668906826622488,
-1.53174002120007,
-0.6791410743438605,
0.18255591158267775,
-0.4407390049319683,
0.15272867597880965,
0.14203862138057036,
-0.6194043976754787,
0.14055544672476872,
-0.06998857089194165,
1.5553470835710939,
-0.8217486790066998,
-0.3245926101294445,
1.0337080093467732,
-0.7888109246472731,
0.1967122454034417,
0.09418809055694889,
-0.32382373627392785,
1.6338211072260722,
-0.3702497629530741,
-1.5955160141094744,
1.1215365074923298,
0.06853661953780497,
1.5367596669300458,
0.3038305281811957,
-0.3930535028571781,
0.16736193576418387,
-0.577830874695895,
2.216342117505494,
-0.851954575594784,
-0.8248003295021944,
0.40301641247730113,
0.3094440606347031,
0.45585552795884043,
-1.2593229007570117,
0.7129988513093773,
-0.18299531822421594,
0.5093557717414051,
0.5250386006038426,
-1.171514529233014,
0.7545817484499967,
-0.4233032996972522,
0.5308667447891033,
0.5231243845228871,
0.4863308952716899,
-0.43848237136665835,
-0.2062144015914886,
-1.1321927103634255,
0.9477348456984647,
0.5667960858009934,
-0.06774090420999129,
1.3015017808506528,
-0.030047726115670123,
-1.2037328084039314,
0.07199550062542807,
1.023964725011662,
0.9240440942799281,
-2.072357674873601,
-1.4566765209478643,
-0.9443621711696206,
0.6669360730110453,
-2.0066127701796406,
-0.9194015183826105,
-0.5378404303613735,
-1.2652951180875633,
-1.5190614494915158,
-0.7944373080146345,
0.3337660738254386,
0.0842373680610708,
0.6234723755071249,
1.3355536770033978,
-0.47873370281001354,
0.2291266010856603,
-0.13262106410247076,
-0.35212400520846954,
-0.7369410290373242,
0.7487534035823076,
-0.8914514077027907,
-0.49958269732664023,
-1.2826610862718741,
1.8336049915949015,
1.0306640386088972,
0.5658594051314224,
-0.32384564567290086,
-0.06567217709201426,
-0.02785664695427209,
0.007203340248018906,
0.08290466213485381,
0.33384828559672836,
0.4807924665451767,
0.3336159272671677,
0.2525021918051858,
-0.08585724137929653,
-1.0120204225533926,
-1.0474436101872415,
2.058431337537311,
0.595511707485659,
1.1522741218033197,
0.6090685211398345,
1.8575113309524771,
-1.4325988241621193,
0.5047266436259881,
-0.5518773998080176,
-0.9172800215137064,
0.609851813599066,
0.6070369750805991,
-2.752244611448174,
-1.8635445200656293,
-0.9688953630950977,
-1.0269674644504727,
0.48643090051767407,
-1.1774903003064223,
1.1035765436548277,
1.278158434749234,
1.0165410072899361,
-0.020423965223704234,
0.7252053137600709,
-1.4394239670777362,
1.400194160653689,
0.6998178194469281,
1.0662234339294423,
-2.481093573172155,
-1.6946865919748726,
0.27269547694592605,
-1.6414053045509485,
0.2199651299561557,
-0.31730351780436156,
0.11311515574243247,
-0.6407263164583793,
-2.0723618033200184,
0.6243640148177851,
-1.7900878973989565,
-0.2704686589669588,
0.30443966676507805,
-0.6383303582514518,
-1.8430104616840262,
1.6226575857466468,
0.4893155957092862,
-0.129822462414151,
0.40054752857443404,
1.1494698083228043,
0.8425751621743827,
-0.4159279844172645,
-0.27908717922634885,
2.2134630731179903,
-1.1818973407212021,
1.0581526356746833,
-0.7151099294068146,
1.7168414466366562,
0.8429044501684788,
-0.7728321389440417,
-0.27861657605486906,
1.279859415366173,
1.813740801046844,
-0.20746038303523742,
-0.5775736821955765,
-0.021449278399736038,
0.4614726846185997,
1.0868995847825078,
0.107219834130807,
0.5163357527954185,
0.00035467792431505485,
1.1285677447815687,
0.7956988767370938,
-0.7111845515614609,
-0.48269918513788607,
-1.27617745638198,
-1.2785663105783998,
0.42971421650255026,
-0.08659405403381765,
-0.3179913277082279,
-1.0058673276392935,
2.1624575804052864,
1.313935731174433,
0.44450894533713925,
1.8499107433171085,
0.8351004446987368,
1.5748430058624332,
0.5219852725316168,
0.46483642841621825,
2.5808821710012126,
0.15038358068136862,
-0.0651688108596909,
-0.8046338093400183,
0.31253229763105167,
-0.2020534244692871,
0.8445044913744306,
0.37267189486084,
-0.3216302836109129,
0.2548625135304868,
-0.011395941786471575,
0.9078347604873834,
-0.32121227803546826,
-0.13813410687432925,
-1.7808967379713587,
0.1152974519590188,
-0.04771223380143783,
-1.2512933100942851,
0.30011565527546735,
-0.36746782606517137,
-0.034243534204484644,
1.151680877048087,
-0.8682236387235108,
0.43400499188498554,
1.311818594776622,
1.609022352238896,
-0.7323106773839946,
1.0348571239073814,
1.5985740253006253,
-0.5152250115311531,
-0.2582648816188371,
0.12904473702433575,
0.1131861526596317,
0.5278777052275212,
1.304682567391353,
1.4403184141701428,
1.1954081675816672,
-0.6038762839701225,
0.9604920718653859,
-0.10941573768529389,
-0.5252395232260736,
0.14632314498736368,
0.6249833566617866,
0.6478393051092632,
-1.8494460047335954,
-0.9499372668216448,
-0.9277451703479235,
-1.4504224781794086,
1.1608257843328254,
2.2780245647995176,
0.8735963050260758,
-1.0975476708402334,
-0.9462559460199451,
-0.09178031962365883,
1.4139866615983165,
0.5495808676885068,
-0.38057438522041787,
0.14582717079855878,
-0.886787074373309,
-0.09225522228395815,
0.01558050474211515,
1.1111823570347175,
0.415745673975107,
0.8863526051946166,
-1.6418332810894132,
0.5505881165588589,
-1.2370908368703661,
0.999312459167944,
1.238504340770088,
-1.1905086711806494,
0.42176895357339517,
0.5651289181419227,
0.5597096162240075,
-2.201829879588915,
-0.22384021312242997,
-0.8152452486896439,
1.2062218346205054,
0.9847882837735563,
-0.9832680147147154,
-0.8810472374393019,
-0.947510967925577,
-0.3767910984116615,
0.22961583974663596,
1.1161200983370654,
-1.5240900068220398,
2.1853079175118766,
-1.3096876664287718,
-0.08148343315867516,
1.025544840116009,
-0.3677341154189917,
-0.6998586931567049,
1.2748327266038169,
-1.169262954010346,
0.902867144618013,
-0.49793228167983644,
0.2409817759539129,
0.193228854717798,
-1.9050597358748445,
0.2443305533651836,
0.02390862528329385,
-2.1350493903255727,
-1.3658076417954084,
0.6972889328725933,
0.1955660786002821,
-0.6549519550759691,
-0.17020824223865297,
-0.896869863558619,
0.5849706762823017,
1.0219520571770413,
-0.12455503224139933,
-1.0853783423534105,
0.07650001482372669,
-0.17563820122550775,
-1.2418961865126188,
-0.22686978016489406,
0.7951857820699811,
-1.651412891718719,
-1.4947999393754468,
1.1476316677475975,
0.25054203880508813,
-0.29825208110834567,
0.9335031265798411,
-0.875971900117242,
1.4973135306168497,
-1.5439539219063996,
1.5953594582475015,
0.6098516180384085,
0.5219107365205728,
-1.5278978737892677,
1.096573683516611,
-1.2397587082301527,
0.26007959881494075,
0.4841541575111611,
0.6585427217637716,
-0.42927773056244195,
0.516932538524517,
0.5375241550683552,
0.4908246949171172,
0.10298946924903549,
0.3285215822083059,
1.6056650198699853,
-0.5312054954321487,
0.346550698276386,
-0.39044563834943463,
0.5052409737509262,
-1.412693812715249,
-1.4571354805645917,
-0.4246886810470006,
-0.9222271304971777,
0.7447303934027335,
-0.5062069845564068,
1.1043508583782498,
-0.0859055758820419,
0.05893821008930824,
-0.6540622041566251,
-0.9618466694523313,
-1.1355283695084,
-1.108722613212468,
-1.1722611694550455,
-0.7003169781899234,
0.45955289243219016,
-0.8230904627354719,
0.9205701920916385,
-2.0218423305684086,
-0.5800427784843326,
-1.588936025380557,
0.5305449928392676,
-0.09114824940405757,
1.2356325925960374,
1.1247609082854817,
-0.6673277308974023,
-0.41876852670016323,
-0.5484702728073945,
0.8071061628650962,
0.4400343586415898,
-0.32817537735130176,
-0.1251254495160923,
-0.2789415971210305,
0.7101369732757227,
0.7587847897653812,
-0.7277493413351582,
-0.10691016332186484,
-0.6861666934517302,
-1.5547106210011374,
2.185207026657367,
-0.39233349825383995,
-0.2088764500952903,
-0.48089619753275886,
-0.9278022938425654,
0.017159561930868556,
-0.8660707339991416,
-1.3064260286757516,
1.643864526363106,
0.12735588480094706,
1.0710609269390041,
-0.98308829708139,
0.5582668711066626,
0.6207879214911024,
2.458644792868115,
-1.678583224590597,
0.11898162848053598,
1.1867411539252626,
1.304358625395762,
-0.08772439378191278,
0.27354037225336425,
-0.3501115180929735,
-0.6716938887389614,
-1.4609546937701148,
-1.2198909312869355,
-0.7519550497828066,
-1.1965502691929615,
-0.8023935397546968,
0.12629898853327232,
0.646054596554066,
0.5783912277239462,
0.5089500237606244,
0.6793819316857156,
0.16944773989947765,
1.1470241244832469,
-1.4244375281513824,
-0.020586639553609894,
-0.9384722851349263,
3.578078183065798,
-2.500381723673456,
0.5719037571634221,
-2.1558140652996016,
-0.4638001543590125,
-1.2151282896735258,
0.032943215754633264,
1.0988312414970676,
0.3387037311073462,
1.251872431226082,
0.1657519208806909,
-0.6986532146645472,
-0.37103809425096473,
1.7054109106440327,
1.230027637172992,
0.35399439055051213,
-0.8261719529510744,
1.2740750496005608,
-0.31658390838896966,
0.5199397813132877,
-0.39838422168980653,
-0.2128839491526518,
0.5287255732005036,
0.49417091458120455,
-1.5234482891538186,
0.33954219947709025,
-0.8507360206764268,
-1.0287260462804286,
0.30362183762568906,
0.8452517436632532,
1.3900855060954591,
1.2056501592578974,
0.8384574268319553,
-0.2749175628510115,
-1.2320071200623957,
-0.07793343503948091,
0.23436143486477357,
-0.9602642870425705,
0.7995371684048046,
-0.14465394111497182,
-2.262039857441146,
0.7630863677244006,
2.4458151846381613,
0.33237462211691127,
0.09882631843729939,
-1.5360943707956398,
0.38546520343895735,
0.5128109259260321,
0.3999858899899365,
-2.0883033871675187,
0.10538620754048025,
-1.0679719030257824,
1.6526245860790105,
0.32335606913439274,
1.463769866457189,
-1.369919469942285,
-0.7760703554448034,
1.2045461771822685,
-0.15338027920031835,
0.9903333496327832,
-0.6324039692735179,
-0.3184977431833226,
1.2447585101855476,
0.8356397182758644,
1.130889375285714,
0.5142488998769777,
-0.8151612416740164,
-0.906045192939027,
-1.2351405908719657,
0.9305960812988832,
-0.3400564596092182,
0.01986697829017024,
-1.2236131745652319,
-0.3183001132999909,
0.46305605133862326,
-1.0165713632936053,
0.4965715145559914,
-0.9986451290324144,
-0.2899358803873983,
0.7703482325098663,
-1.1440803589110742,
-0.12285654550960008,
0.7092155824684169,
0.7301090633472161,
-0.5231294714193316,
0.8945835812629418,
-0.4913795086011734,
0.3539841759949241,
0.5226805747377711,
0.15604822387170897,
0.011781527442546213,
-0.7615348040747004,
0.05476888958877699,
-0.9311184594101497,
0.949640456313073,
0.057779399187055026,
0.9432564633717971,
1.1651603537034514,
0.603283153858774,
1.6128300117672598,
0.5950864920466641,
0.22369066839259588,
0.44997313098716457,
-0.9934267920613931,
1.885592250266763,
0.34285501629860143,
-0.3873085193647534,
-0.9209690733903015,
0.4691305115820045,
1.4122345986158067,
-1.7457091445833672,
-0.055139957480122306,
0.8919070522900547,
-0.20202782094883148,
0.42785190471657614,
-0.6953350313305927,
-1.615176073609567,
0.7168529251907189,
0.13852714298370092,
1.6164402757127774,
0.42718794270903715,
-1.3527234878864203,
-1.8893936066962649,
0.7024128733250848,
-0.2694914871171685,
-0.2184554307189248,
-2.5709814389088406,
0.0017482282882800829,
0.15625563695819603,
1.0324252282334405,
-0.48143154901086416,
-0.22096685086781984,
0.6386837189304194,
0.05451339334129405,
0.7823451956440951,
0.1818619737257764,
-1.6289453608057398,
0.6414204362585184,
-0.6199375500749978,
0.39042477078011006,
0.09903526795419784,
0.12109450711472211,
-0.4380234954816039,
1.0550165199607273,
1.458644758294392,
0.1534190174019172,
-0.2917657433898585,
-0.5018654057249979,
1.2230261788938628,
0.1917059972113898,
-0.5200270695994803,
1.2830228783487791,
0.41553401706184684,
-1.1172403398355233,
-0.47966517674495956,
0.8475980823460028,
-1.5680723789720397,
-0.40168125051621545,
-0.1539097190480322,
1.1244353665892033,
0.7088120195706531,
1.325942203703706,
-0.7674513161205037,
-0.435722476851215,
-0.25436994521271883,
-1.280611007727449,
0.8430870716381652,
1.6068233602156978,
1.4110851879493658,
0.22165254870258488,
-0.34579131268864166,
-1.060009073788909,
-0.6532035546539645,
0.09257222167465945,
1.2883010855572345,
0.9060247390976592,
0.8030530152104499,
1.071669176588516,
-0.7219493863378733,
0.7305935916943332,
0.2671749550080706,
-0.15833670809929817,
0.9291634794716931,
1.6219904175952158,
-0.6386255754665136,
-2.157800360686597,
-0.3114173765005886,
-1.6791143516571883,
-0.5312200057247158,
0.8307418952023724,
0.6782559693699368,
0.29553578703325417,
0.4644063895821546,
0.05400712544130151,
1.877565299774221,
-0.7624947639176476,
0.5437082531796342,
0.4552597235932206,
-0.5234711246185475,
-0.40898004186358833,
1.3612612848959724,
0.5050294578728493,
0.09448191144444039,
0.5073959748497192,
0.9498670745921717,
-1.1241322809321066,
-0.11780742051196284,
1.2279015434903562,
0.49735587168630346,
-0.6712501883732391,
-0.8075874301074858,
0.5350904013153799,
-0.3783006377827384,
-1.476872682064255,
-1.1018818207191114,
-0.3168589740240487,
-0.06687107818397563,
-0.17844204845776193,
-0.0764542880736754,
-0.3295010331290744,
0.10932544017497044,
-0.3591924579713071,
0.05015628239507061,
1.1807423711167746,
-2.1679607435086883,
0.4894444778137506,
-0.25396896392296164,
0.5051992129789475,
1.4068384416342643,
-1.447214545146917,
1.3048135869630635,
-1.5443829291538496,
1.0516351895291285,
0.11967961537934373,
1.3124311421947032,
0.0893727791387239,
1.1509590805133247,
0.4699983122521323,
-1.1033927798398602,
-1.9928036790871628,
-0.1929463465367211,
-0.002339791076971496,
-1.453935007402766,
0.576670681325618,
-2.0808240954400192,
1.0405556530262003,
0.7083938900586545,
-1.1790422698459102,
-1.5745730934465239,
1.8422822715077987,
-0.0075974942059632185,
-0.5054537565487633,
-0.4118891848669998,
-1.6491710610736543,
0.34186214711566193,
-1.0214667665998485,
-0.4064380757244341,
-1.3215516203674487,
0.22632709935765724,
-0.19698843806928407,
0.27990934571240694,
-1.6923691702166819,
-0.5394573226709022,
-0.44613746732866694,
0.6815826460079577,
2.447251040207078,
-1.1259113169564787,
-1.048574978446278,
1.3289545009083819,
-0.13980134714891881,
-0.9806066594742343,
-1.664490901864089,
1.28756622249991,
-0.9105402716037129,
-1.3707908875018855,
0.8205183506373512,
-0.5307790815804455,
-0.7088535896533693,
0.018377323454450572,
-0.18974487659200143,
-0.3405723301549672,
0.573780365237398,
-0.32413393593552375,
0.5961024855314735,
0.3713121905301276,
0.6969752346402429,
0.07994727611981915,
0.944457989313725,
-0.7173968204300329,
-1.8382052833201192,
0.377254857799456,
-1.0184759525301956,
0.0016110369084946135,
-0.4592449912915085,
1.2298109223214746,
0.2309021171041038,
0.8286762695348034,
1.1561179670606279,
0.7101510209662335,
-0.7242659653427427,
-0.07566425002713091,
0.2527138484547471,
1.970148870444275,
0.5301450520129584,
0.3118635370706107,
0.20690301248899529,
1.8077089156409272,
-0.801939258830938,
-0.8128627252285936,
-0.239281025580598,
1.5008652689490851,
-1.9371537837457806,
-0.31983507544041134,
0.2699541230694249,
-0.9283643046938963,
-0.20333228156249863,
-1.1991208232423833,
-0.5416256579088424,
0.24005652498567978,
-0.03765795316045313,
-0.2595205585494929,
-0.349045643708073,
0.4627569446330344,
-1.0958422789724447,
0.35331653236452126,
2.528797144984769,
-0.07824039516140144,
-0.5391014913838651,
-0.0991140905780404,
0.5914139094431474,
-0.9699293901049979,
0.43283910455989305,
-0.34702230212983687,
-1.1630094051424074,
-0.5334100006567914,
0.5915260091950925,
2.5765843146225014,
-0.18577246792990149,
0.4125097277690908,
2.1097275602718706,
-0.757646512696169,
-0.24133370767252812,
-0.8449232347156259,
1.5873755935866996,
-1.9801832082901958,
-0.06110858851515521,
1.181970359372405,
-0.6869768505913938,
-0.5196881292256552,
1.5645117311074455,
-0.140116000173871,
-0.25722519214253026,
-0.0009252462254670271,
-0.8221857423700093,
0.15882202634104442,
0.17514828238807653,
1.0112623341068383,
-0.3545558400247684,
-0.6085328815077076,
0.22143852768197372,
1.2275071178041752,
0.1846284206220905,
0.6673973871825072,
0.12503453672573817,
-0.16512946721813135,
-1.5475903920768734,
0.062484875168070074,
0.07213885528983083,
0.5825258997519853,
0.31502496208615766,
1.4027102003652825,
0.5164445039535557,
-0.5896011079368502,
-0.15378059419520604,
-0.2547105871594367,
0.20040745695099618,
0.12342001430787573,
-0.34561428221702845,
0.6685285383046716,
0.30637459164719283,
0.7726406553933493,
-0.39321585346373644,
-0.3956425569045313,
-0.1905562124516262,
-0.9984369904620998,
1.4710359031638136,
2.7886469672444383,
0.29248521215338374,
-0.3016997031330457,
-0.8437194174695855,
-0.458202874718689,
0.9863027715428859,
-0.38543125540126466,
0.007958214775502903,
0.9068168622474152,
0.6183534378634528,
0.14008106486680064,
0.14980543560385728,
1.385391231987713,
1.03482391042334,
0.5623448985439791,
-0.5861011183814293,
0.8253975665291471,
-0.32823189286726284,
-0.34932982371796906,
1.9771493891112246,
-0.3846822209325373,
-0.5599534221686684,
-1.5421004274734416,
-1.6362095253234992,
-0.8274680121576379,
0.02866783737884461,
0.6131571850140284,
-0.49184915064791074,
-0.7100249324705236,
-0.10748480391692494,
0.2816822659542479,
-0.16506502298412942,
-2.418009317108484,
0.275272579844644,
0.316007408514435,
-0.4349845602295069,
1.007329966353254,
-0.3002298452924346,
0.2498636792807511,
1.3499941016914927,
1.4686584525070965,
0.46198668596412507,
1.0570356149106697,
-1.1671225548191106,
1.0903625548677267,
0.29712767888947106,
1.9290226029027833,
-1.64871456024875,
-1.7299643957534048,
-0.8092623988896502,
-1.0209502557708223,
-1.0484772935118132,
-1.7840826252071469,
-0.34416912597575194,
-0.015452483343944896,
0.6600085206250803,
-1.14969903453599,
-0.1503050569863905,
-1.5469568166688181,
-1.2775061262460383,
-0.42900916645809406,
0.47343811490071874,
0.2523460716085661,
1.8098196906912505,
-0.7425966463925198,
0.6950249328834867,
0.07568181855872134,
0.1562831860463586,
0.5861005304583894,
-0.7593586945463725,
-0.10930229532094383,
-0.5639771783344245,
-0.14651633364479363,
-0.0929263846409421,
-0.3636861228005544,
1.0765519382370643,
-0.48959404004657253,
1.8039399321253071,
-0.48383562465341906,
-0.5360633821028372,
-0.501811442818982,
-0.8837297021398576,
-0.9541996525003357,
-1.0998485635446678,
2.3004225765801207,
-0.7874492463755874,
0.00818747163046311,
-0.579662065059793,
-0.504946390343611,
1.4293374877961322,
-0.30692669903132247,
0.8686354742301657,
1.5168569232353564,
-0.6821163106412085,
-1.181572825053179,
-0.04282806528183298,
1.828341835610176,
1.0798570852057339,
-0.1059325137813747,
-0.14039951065848758,
1.733604526054252,
0.5288002467827642,
-0.8077222694547955,
-0.31767318833089403,
-1.6738484753581009,
-0.8301506291177148,
-0.35618980480452334,
0.7193915145205464,
1.8538830657987706,
1.083430601422198,
0.15107160895299818,
1.4222645516183396,
2.382187087880199,
0.16122698332332083,
-1.8120515557522532,
-0.6242760382467106,
0.07264144689661092,
-1.3501926559247674,
3.0026036720567864,
0.011646806016670086,
-0.055817011080435006
],
"x": [
0.5517358153719154,
1.8596856650504239,
0.2559493773630311,
0.4267621147801106,
1.0303928372690256,
-0.21995636142807692,
-1.48775847925914,
0.6828420907281039,
0.8676411702254289,
-0.4689162331252265,
-0.007243330973151989,
1.0856954751892256,
0.3729391425102879,
-0.8452682037714544,
-0.6606637639180126,
1.1881604503231573,
1.509439165595859,
0.5026030305828314,
-0.18775015547113783,
-0.11385685989847272,
-0.22190132606357085,
-1.057434896468146,
0.3239460578166787,
0.19682413827429615,
1.8962486436018036,
-0.6185176485688241,
-0.2653362548696484,
1.0062789094179332,
0.010263207224090997,
-0.2546869119764967,
2.488998048114674,
0.9716872276315218,
0.16028922961388045,
0.6118310248711115,
-0.7830699567825833,
2.4840192109770656,
-0.5786120710030704,
0.5774775554017822,
0.0502948699073328,
-0.6224248632577581,
-0.1557129701813185,
-0.545129914841028,
-0.5351095611038622,
-1.8485681862411267,
-0.5887133346489545,
1.7785558307343523,
-1.3227954607865813,
-1.5186610247277408,
0.08694702409281607,
0.5494379128835141,
1.3098378942778721,
0.4063026014845666,
1.0467634324376764,
-1.1144042646052474,
-0.20586505632160795,
0.5126172885441473,
-0.18810979279263101,
0.16068044464289893,
0.7513746862677065,
0.336875126427106,
-1.776669157775326,
-0.6561508739207859,
0.546213329935606,
-0.48758259091688294,
-1.562860510215723,
-1.2584173531903022,
0.8531108966376486,
-0.3503199160866252,
0.617402013851171,
-1.0578744765576364,
0.7220532123093989,
-0.1827298451572791,
0.5196703093975108,
0.07640442581329623,
-0.4616448697733386,
-0.14375694498010635,
0.12106922659754689,
1.063662186802877,
0.9582437255798224,
0.012241857416885342,
0.1338907611416042,
-0.6984746293604397,
-0.7346571274300715,
-0.27238837685479245,
1.238216334453776,
-1.3181078161665403,
-0.6225400400673234,
0.48488556983137693,
-0.5013381474644825,
-1.8336227480106515,
0.7043177687111276,
0.5289448647837091,
0.0744654388849224,
-0.3138091143283045,
-0.018588803232060223,
0.5698127601764994,
1.5672367298771643,
-0.5171495969900004,
0.8272699568918525,
0.32329706817233567,
-1.6485784207464986,
0.6571222276672871,
0.5557905957535811,
1.0833735467859218,
0.27027843092130627,
2.0237314895780587,
-1.0665799594048782,
-0.6424891020500826,
0.96393097877984,
-0.2261144378143976,
-0.14626670314823434,
1.2836054717386984,
0.262577696099332,
0.9100603158389994,
1.1225192451366521,
-0.42919266831448866,
-0.42053451272830517,
-0.7596945894831406,
-1.1499262811654158,
-0.39995612171901457,
1.5203256635158817,
-1.75321416941752,
1.48914414139483,
1.102337663594689,
-2.1317250131960637,
-0.22742081856038937,
1.7545785301565269,
0.9923186198266409,
1.420132252962422,
-0.6667830997924487,
2.1251682359187263,
0.5579451944826713,
0.0455051798257824,
0.60997774591779,
0.5330763926740577,
1.2927580763099253,
0.33507459278750384,
0.07959389464962469,
-1.0957767346516878,
2.000641737548641,
0.1494400393715099,
1.6652517739243815,
0.6325057552644096,
0.22288319750159544,
0.2487966684883018,
-0.06657480778221808,
-0.7247554332588605,
0.6029848437299589,
-2.111683019276139,
-0.9107941512758402,
1.6320878711040814,
-1.491348022510939,
0.3684835625599839,
0.978171728528619,
-1.3395747739647204,
-1.2027727228723262,
0.7902487100307243,
0.44878138107716525,
0.8951022699902607,
-1.0796117754094683,
-0.8165701007589823,
-1.8120395514930303,
0.46251285101919787,
0.351792447905658,
-1.112937839825685,
-0.9476498811736848,
-0.8113743119356208,
-1.7359359349449222,
0.23500994570269865,
-0.5906240031187413,
1.3928887400774497,
-0.1608318763605557,
0.5331963646997523,
2.2111400826062777,
0.1345365082558566,
0.2833509059232271,
-2.3835783462579716,
0.220070985940662,
2.034386679361888,
-0.5766807920967474,
-0.8816407711654564,
0.2725417157701554,
1.8409966091949175,
-1.3376439076499305,
1.3651397365337146,
-0.10404693475583238,
-0.7156335018099547,
1.3389488389147932,
0.01041882306452814,
1.128874750131139,
0.2746936661696892,
-0.10547410337020052,
-0.03438769896691634,
0.1485932440368344,
-0.30310465242589074,
-0.7607242318393068,
0.11311138211085998,
-0.5184102548672528,
-0.31937103435236885,
0.15692068094889353,
-0.6410116116921795,
-0.10814780046874752,
0.1221004569512417,
1.1205009487250448,
1.3296775670667111,
0.36291984997055887,
0.6418042207703867,
-0.7288240665458762,
1.0288171218585092,
-1.020191384115513,
-1.7045826436182019,
-0.44353333532464,
1.4325388009328186,
-0.3113297016676152,
2.0548230019227502,
0.3608016534481259,
-1.9536911458798174,
0.5584437065371746,
1.173510112901001,
0.8222256903883629,
1.329260711226385,
0.9279188185995408,
1.500252728036802,
0.9936939320396492,
-0.1674654310754587,
-0.41317657314252487,
1.0852986736269539,
-0.6697808110352151,
-0.978623319984737,
0.043526215185592826,
0.6494797948934043,
0.3112047942319653,
0.7184053582226475,
1.0928573732617062,
-0.4605821143306249,
2.1714429705175196,
-0.3212327238856573,
-0.4787592815536117,
-1.1900614758586971,
-0.33866714180447527,
1.2100082129923397,
0.00005069394264077311,
-0.5985292050266805,
0.6982258040709794,
0.2691315399281361,
-0.6543713940945559,
-0.5907652326750494,
0.5209322963470089,
-0.001996569002265111,
-1.6445915451761346,
-0.6409741710173611,
0.42191039012246917,
0.6508151568462688,
0.9763479688844741,
-0.9746829807122019,
-0.29401243737587723,
0.9397596888451155,
0.28560212473380536,
-0.1415609052380373,
1.2888209477499308,
0.7847502910325664,
1.4127633280335692,
-0.05046777899116238,
-0.996953091487536,
-0.9983887407153221,
-0.8847621858875515,
0.5625305835747085,
-1.932184878975391,
-0.5524630742268861,
-0.5157628901730898,
0.14668901000163226,
0.5062670591395815,
-0.7552554866804556,
0.24372696501493635,
-1.0800750755505115,
1.1618952775473674,
-1.3720693399015582,
0.2962444187388261,
-0.8381938090225557,
0.41718589395213146,
0.020318885023164368,
0.4543422901795276,
-1.256802706939659,
-0.7796018144939137,
0.5448399638367589,
1.41025200114534,
-1.0394250876083928,
0.42524089596733616,
-2.24588726114261,
-0.7647471565341949,
-0.5226454540479301,
-0.4495899125860699,
-0.5479327460024914,
-2.0930325813570527,
0.15837562471592492,
-0.2926925153329295,
-0.041476483678009546,
-1.428122209028952,
0.4846502515404874,
-0.4630604868495845,
-1.07411468129995,
-0.5441798796988172,
-0.8521382207167263,
0.15721514740915138,
-0.8337726809148116,
-0.5242842232633493,
-1.207070490430427,
0.29646566584502354,
1.0651929026752702,
1.0913082879489957,
0.17327253585703084,
2.069807730075716,
0.5474928486429637,
-0.06748897736583873,
1.4659957051534325,
-0.05972800670141301,
-0.9384914205981949,
-0.6550450322803221,
0.1880758450296847,
0.7481663247328263,
1.203339381800044,
-0.501791256236201,
0.19308339889349962,
-0.9539696431847701,
1.0150090828411718,
1.0308250379859443,
0.26072889973565166,
-1.2602795466493866,
-0.14540011500534403,
-1.6303138012577196,
0.3347670377262103,
0.9539371637324264,
0.16006181266233085,
1.3238058165325086,
-0.3921755438313933,
-0.484178302850293,
0.36695068905984435,
0.2995593524495587,
-1.5577410635052493,
0.04864914798868523,
1.2315685539169254,
-2.0173671890424916,
-1.1043570777617973,
-0.6411617738122354,
-1.1038066555561317,
0.5033005830075767,
-0.0804453992488778,
1.881062520349101,
-0.862202852918843,
0.4765895381590545,
0.06626848169588076,
-1.085378460510359,
-0.2554891186524839,
-1.0810425567394624,
-0.3326240030158358,
-0.705061560374423,
-1.0622666181493245,
0.3889417385993588,
-0.5264002782525329,
-0.1345798184551279,
1.226675042831121,
-1.4546597276956703,
1.4341141860235687,
-0.1368709718981854,
0.2916747246041206,
0.2616848566574071,
-1.7165392397999304,
2.2899865871310503,
0.5125801996047608,
0.8884909646440419,
1.1516033947306272,
2.476858116413206,
0.10555803400888678,
-0.326648031616811,
0.3599639778672759,
0.07752042423481117,
-0.5194561512957202,
-1.0435082324331326,
-1.8337360437079837,
-0.4174761187013194,
-0.23105803896824909,
0.2999170605152689,
0.6922583219035607,
-2.368315256912434,
0.6641804678920861,
0.8800781913011554,
-0.567289813101733,
0.7265017459537065,
0.00764257437350976,
1.5504160050719245,
-1.4186624882543752,
0.9456339230955476,
-0.5942892920955395,
0.5452971391769809,
1.4620308353452292,
0.5856434657214397,
-0.2846292160651085,
-0.24611177096266193,
-0.06607270852382031,
1.0429902063979735,
-0.7334418740350721,
-0.19223363712757197,
0.6555736130144555,
1.0822292265056308,
0.09359722172096123,
-1.5982071458477194,
-0.4696572884752107,
-0.14626876230292266,
0.2748720676743406,
-0.40674015229085675,
0.41572301925194965,
0.8264143539773211,
0.3273520633692861,
-2.5956325884883484,
1.1143790167076428,
-1.5021271556328757,
-0.8951259391646708,
-1.8742046402675743,
1.6155718490366582,
1.2017681176404211,
-0.4514875001852952,
0.2279751422622887,
-1.6104619148205757,
1.7458256531495926,
-0.8825709097614857,
0.4993541948764201,
0.7758431766462721,
0.8708431600669048,
-1.3684116545212275,
0.5202011759085313,
-1.4290979529400765,
-0.32944596456568587,
0.506036915689039,
0.3306755629707809,
0.4588895207977291,
-1.4399529246436626,
1.016780937911283,
0.4627278491264451,
-1.1585283542133014,
-0.3798656921001318,
0.3546518240869597,
-1.028071051498755,
-0.21479921576610703,
-0.8432881140799656,
0.7802499318208717,
-1.1841403784878668,
-0.48227781825880234,
0.5744615422457665,
-0.3603349251531921,
0.4041543234338988,
-0.9239598301488143,
0.6291228426937961,
-1.2988060228036384,
1.3234133224637512,
-0.036168831129381025,
0.039236139739806566,
-2.6358755540868084,
0.2828644118309311,
-0.2288775935532013,
1.59576187938997,
-0.14964509320907615,
0.40811141677969964,
-1.6319685785201221,
-0.4099766340232993,
0.3801537933694631,
0.005355945790352048,
0.03782472014050448,
0.04499635534475524,
1.3757559465175204,
0.9148481532819499,
0.4224787229239022,
-0.4724002178970954,
-1.994779265061565,
-1.1732288894876293,
0.13178443029407869,
0.5205050757413702,
-0.2509806684796548,
-0.2662243928582628,
-0.31022043578755915,
-1.002642553788455,
-0.6437428048969087,
-1.2538973625328178,
-0.7657135778211865,
-1.1775629975410944,
0.9672943877090205,
1.6356880006089816,
0.7527327683203464,
1.6869756001848795,
-0.2942871919784577,
0.10371708916977382,
0.5623538565108256,
0.05807347285666523,
0.5566323170700709,
-0.5010822027321078,
-1.0303456538688898,
-1.7518598155990592,
1.0630738314985468,
0.9976798395955387,
-1.1769935744136373,
-0.7147010148575672,
-0.5828852320760316,
0.43877480281205417,
-0.561086793652168,
1.4502144068391762,
0.24983438404738859,
0.3148480405968159,
-1.4889867596302286,
0.3331976209557807,
-1.0274357979285007,
1.2511964360978352,
1.1916454766834572,
1.2761076841831689,
-2.7656618229886836,
-0.26815243921278675,
0.09139088493852163,
1.8679321253953187,
-0.9926235949874939,
0.7846237070900726,
1.1582936703310593,
0.007886688344991902,
0.01691332692601667,
-1.4184068769122753,
0.41589089828050996,
1.16133357626907,
-0.5238246386825435,
-0.2758371360194672,
-1.1389936776167298,
1.5745282761903465,
-0.526776703714527,
-0.5102244209916502,
-0.4111965792130382,
-1.0520747258554723,
-0.058141066676968896,
1.849521951353324,
-0.2221768774099879,
-0.9422576037549992,
1.003802335155322,
-2.065803642280997,
-0.5921164228527648,
0.31188722302266136,
-0.04602770935487745,
-0.4951109926231999,
-0.6826061848500168,
1.07615128407416,
-0.30015516640503126,
0.6872404813455274,
0.9162834369590059,
-0.22268037552329442,
-0.7725799567254733,
-1.4450411420398903,
-0.3108775292650534,
-1.1337927421071956,
-0.07111793304445353,
0.16860036515787347,
-0.8275766504837031,
0.4862733771114321,
-1.4025566515526875,
-0.332366666692537,
0.6851285548784986,
-0.3512300899229963,
1.2028823143424872,
-0.464739370318725,
0.9690546646572463,
0.7871194855978099,
-0.09589295720397376,
0.9863453010621931,
1.7096447701925257,
-0.9318872592248589,
0.07904516629256073,
-1.0366963764978263,
-2.002693020086732,
0.20280848406425805,
-0.04768613690813412,
0.4530117243336931,
-2.2499958887561258,
0.1701947801625045,
0.6278289350899425,
1.9817491702269971,
0.0015574171076484624,
1.0170597019414571,
-0.5042043522796321,
1.8970294733262159,
-1.2406452942392798,
2.0889906374166385,
0.9788582364251761,
0.3226984262316757,
0.6388503942361348,
-0.025098358318564343,
0.440527327207623,
-2.1278152663651007,
0.9943190034133471,
1.1132117513639355,
-0.95910818292478,
2.243187431681288,
-0.27910187885751947,
0.9680110508318904,
0.4409061447003136,
-0.655071095785884,
0.5977867745722959,
-0.6952972529312419,
-0.27365602799202104,
-0.6114205398079509,
-1.2908594671933038,
-0.5576179683209309,
-0.7770247723446372,
1.9830964562373778,
-1.4519973288953716,
1.011329219815063,
0.963777825258269,
1.3590280965968515,
-0.22136921009858387,
0.42238454465833974,
0.3119710587982782,
-0.34251625971879435,
-1.7110442804489576,
0.8302275840661619,
-0.11842795687358955,
0.4655998355002478,
-1.8740146330990932,
0.17009633541963767,
-2.0404706112933337,
1.1113212425756789,
0.4697722607998287,
0.4469810169968007,
-0.3943776829537722,
0.1651937231149004,
0.8839172945106585,
1.2992147358913197,
-1.281250686151679,
1.164109514900069,
-0.2083138643241273,
-1.4457986920651962,
0.06895720562126742,
-0.20405771955094626,
0.753590636583518,
1.1789846547817353,
0.29162505029365604,
1.04600507755422,
0.27994168007872744,
0.7229336948296676,
-1.0119491123478417,
1.1388123902112177,
1.4480264209742577,
-0.6142253304574431,
0.8845984699445768,
0.3130310921363415,
0.7685896071245499,
1.2334998286106067,
0.5106256958884137,
-0.06496782053566692,
0.02158425638906417,
0.9700512765269487,
-1.4243976339887596,
0.6580348420833138,
0.39472418495432077,
-0.4805007049769727,
0.18818891506689137,
1.1903698625115975,
0.9018176527332049,
0.32469956064856914,
0.22022777115624093,
0.8506836900121508,
0.6875758862312398,
-0.857883522237719,
2.6614182220533755,
0.01774869010380322,
0.835480630327383,
0.8611798919178884,
0.1350482860121509,
-2.057220232644297,
-0.6752343737195677,
-0.4112260401723478,
-0.6422466008982837,
-0.6281215990315384,
-0.5477681746426277,
0.9841530014764742,
-0.31380366560373235,
0.9951146682585773,
-1.7743397162760761,
-0.07687868502151932,
-2.4524650326891524,
-0.7429203175299367,
0.11865443873208868,
0.48201780444346637,
0.08184508368172962,
-0.05715800027594504,
-2.589906512147972,
0.8917195012297315,
0.7717466216882449,
0.9981122031245623,
0.946836866067307,
0.6540758345409791,
0.662556392283872,
-1.0359731514051387,
1.6604701935090633,
-0.49025396199425286,
1.6955170089341594,
-0.7262286476665654,
-0.8379903264606976,
0.1071285944950832,
0.33567819291772566,
-0.29713107434503166,
1.0008312705282336,
0.8865324974728063,
0.3599690880940248,
-0.2914405239922783,
1.9007969838438292,
0.42089737275512473,
-1.7410756649461114,
0.8908750536781141,
-0.1086495766165154,
-0.2984611224745104,
0.2332426439737034,
0.7365725615367711,
1.4229530353245292,
-0.34580504869685147,
-0.6130872223190846,
0.3949100847635531,
-1.6071166297682111,
-0.8428921364008639,
0.47530355641989175,
1.4930706356628742,
-0.4773630505689621,
-0.9074931902509192,
0.533976768266492,
-0.7480954164249929,
0.9586881479145634,
-0.2059065324680541,
-1.031579126011465,
-0.5566146407628645,
-1.08779546524431,
-0.9249420289907976,
2.7922758008737456,
0.6608528380334445,
0.6053337334428843,
0.5817505990572586,
0.3540314160533165,
-0.12383461865141444,
-1.1560169918162435,
-0.5783765548284089,
-0.14547851989502356,
-0.7508008724830622,
-0.4644384553228747,
0.2989997467530827,
-1.0923261445958357,
-1.233902998581808,
1.8139080351713879,
1.5296224523754918,
-0.24833439696943377,
-1.8339018997704464,
1.4394505750820057,
0.284131811004483,
0.34847254171321806,
0.6319081480296347,
-0.06270402062442655,
-0.350187432354685,
1.8544325989008548,
-1.245240383321969,
1.0666639794787902,
-1.3031983410395833,
0.1621691002548723,
0.12084862180469232,
-0.6743314570923689,
0.25399900708809386,
-0.6639730503519977,
0.8062708981400338,
-0.6246905030394698,
0.8169207071943786,
-0.11281414031648818,
0.7729010508440042,
-0.5116584087776312,
0.8886988670250827,
0.63336910655313,
-1.2889680562979018,
-0.3109028022061065,
0.8982316879955198,
0.3822646895956034,
0.10014137027834034,
0.6718547698300577,
0.7253461876598821,
0.6505005053361426,
1.0716972810674286,
0.1642139851744131,
-0.32869548424600875,
-0.8707216294476575,
-1.0575080241725359,
1.311813260813569,
-1.3146053331053213,
-0.3675076578345247,
1.1761038802369284,
0.6033874437042821,
1.7490690551861714,
1.063273241034222,
-0.19871144681937156,
0.75019374598985,
0.5035672356440332,
-0.19397322390131197,
-1.4731073061592808,
0.8148387392086904,
0.2935712195274169,
-0.13801426727298358,
-0.31799159333660465,
-0.22640075534432405,
-0.9260691722749022,
0.8033526825367908,
-1.4180836151147633,
0.4252324809542826,
-1.1122230665277684,
0.051396467525912905,
-1.859512155929798,
-0.2535052643488076,
0.13574135168606583,
-0.7790672791736243,
1.8956340721096474,
-0.3502941551130104,
2.338962867089944,
-0.9138046928819709,
-0.06910456444925306,
-0.21018195548654786,
3.459970186776726,
-1.5871807789691676,
-1.4187705448078405,
0.27667162637722537,
-1.234161557811994,
0.9709835746556974,
0.38369276477756487,
-1.0783487820267528,
-0.8235012783419388,
0.8512432342560516,
0.6210697201157659,
0.3971565819881172,
0.21336608737661167,
-1.0304394401321442,
0.27667402820689824,
1.615414205528756,
0.45953854272368316,
0.8430453085815799,
0.6532382093483255,
-1.084629928649699,
-0.9795679348384833,
0.6767769119437856,
-0.6992039321298017,
-1.3549731006135364,
-0.5138388222915499,
-0.12032073986122405,
1.0379074764085157,
-0.889261736450601,
0.33703033691144374,
0.9061897631374058,
1.0430913475158854,
-0.3271485325787957,
0.45714519492471667,
-0.6726728129312801,
-0.24713556399775627,
1.2588958063212254,
1.347243933044315,
0.7489752062611641,
0.46799616596544963,
0.7525024985474119,
0.9081540779360613,
0.7379903987016839,
-0.17174694367055607,
1.0238314327870657,
0.9008768374277851,
-0.6103003900447531,
1.4398983014624476,
-1.2522587945638985,
0.7511268522865069,
-0.37025259529156834,
1.328655627531034,
-1.101647686683086,
-0.29692139790090166,
-1.4440165456171143,
2.4306188959219006,
0.11326583411290875,
0.7278297663354891,
0.7006011733699072,
-0.494648930291042,
-1.0425057738762569,
0.9504530952025758,
-0.18518939995802555,
-1.5735228590075345,
-0.8111559233648801,
-0.44160899159165223,
0.5304432776306044,
-0.07777035715421667,
-0.9761789926043856,
0.08700365171351512,
0.8652710067561727,
-1.5912762362996713,
0.3335424155761014,
0.7438835743687975,
-0.1850542501229366,
0.7321463542945255,
0.6175434724952259,
0.4277257665377576,
1.1687231084470806,
1.1434558667542685,
0.09323533782466753,
0.07022493236528,
1.2644412168614456,
-0.38207859567496,
-0.6204915828268899,
-1.4688871024023171,
0.48927614103779116,
0.14738332928640896,
0.7572235183786001,
-1.2881811562096805,
0.7227090445056253,
-0.30584777580565997,
0.4312421082482375,
0.5345196736216129,
-1.869677410846927,
-0.7696510641646256,
0.7006474854819382,
-0.9011344630886097,
0.717234632640105,
0.815840658916873,
0.9678018602523579,
-0.6033674708585613,
0.32465325154777647,
-0.5134815057080843,
0.11326656017354542,
-0.19768008384674787,
0.14043486577737455,
0.8755143367380276,
-0.19300690437209153,
0.33470272905780146,
-1.3212332154738569,
-0.731965641538693,
0.03135301641452205,
0.29938589200956084,
0.839666714436024,
1.9011916812572,
-0.5834173749799207,
-0.02531931294118173,
-0.1602296547518232,
-0.6075870766296664,
-0.8399461705952395,
0.588967584502103,
1.4251039265134289,
0.1095984587837429,
-0.23656240030120246,
0.11050191519464982,
-0.2154847210756999,
0.568561958112757,
-0.7502358902791435,
-1.4767657604727487,
1.3002163871907244,
-1.6147915278106204,
0.4014994158530208,
-0.010248915152518148,
-1.5373940644410646,
1.5400435691596845,
-1.1956305659760131,
-1.043247811478652,
-1.2287880254726278,
0.8681323859487643,
-1.0032094679897232,
-0.8674507019922186,
-0.7478573784849081,
-0.286057638225918,
1.825852196163113,
-0.14018289337057843,
-0.7566239234498925,
1.1962445090638758,
-1.115168005842041,
1.052604075749197,
-0.6490611010887193,
0.8489876142291175,
-0.4919134444976713,
-1.3459434644155945,
0.27064746968158443,
-1.077463952260525,
-1.1779502392574714,
0.3976188396476993,
0.4624918009401488,
0.3611684747600712,
-0.038778801539407076,
0.21205837480229592,
1.51727275929075,
1.1329492020847074,
1.3679919621703949,
0.17080887777225376,
-0.41401218003475915,
1.173065182222338,
0.9102424606412803,
-1.222405237794098,
0.7168117729590421,
0.3624979788442912,
-1.6635843500361454,
-0.5998768800846025,
0.4498622088768711,
0.6091985990079132,
0.27691975946544584,
1.5291592963906429,
-0.0669210757860148,
0.02723086765848846,
-1.045004526053497,
-1.0917421228806616
],
"type": "scatter",
"mode": "markers"
}
],
"layout": {}
}
},
"metadata": {}
}
],
"execution_count": 5,
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"source": [
"trace0 = go.Scatter(\n",
" x=[1, 2, 3, 4],\n",
" y=[10, 11, 12, 13],\n",
" mode='markers',\n",
" marker=dict(\n",
" size=[40, 60, 80, 100],\n",
" )\n",
")\n",
"\ndata = [trace0]"
],
"outputs": [],
"execution_count": 6,
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"source": [
"plotize(data)"
],
"outputs": [
{
"output_type": "display_data",
"data": {
"application/vnd.plotly.v1+json": {
"data": [
{
"marker": {
"size": [
40,
60,
80,
100
]
},
"x": [
1,
2,
3,
4
],
"type": "scatter",
"mode": "markers",
"y": [
10,
11,
12,
13
]
}
],
"layout": {}
}
},
"metadata": {}
}
],
"execution_count": 7,
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"source": [
"trace0 = go.Scatter(\n",
" x=[1, 2, 3, 4],\n",
" y=[10, 11, 12, 13],\n",
" mode='markers',\n",
" marker=dict(\n",
" color=['rgb(93, 164, 214)', 'rgb(255, 144, 14)',\n",
" 'rgb(44, 160, 101)', 'rgb(255, 65, 54)'],\n",
" opacity=[1, 0.8, 0.6, 0.4],\n",
" size=[40, 60, 80, 100],\n",
" )\n",
")\n",
"\nplotize([trace0])"
],
"outputs": [
{
"output_type": "display_data",
"data": {
"application/vnd.plotly.v1+json": {
"data": [
{
"marker": {
"color": [
"rgb(93, 164, 214)",
"rgb(255, 144, 14)",
"rgb(44, 160, 101)",
"rgb(255, 65, 54)"
],
"opacity": [
1,
0.8,
0.6,
0.4
],
"size": [
40,
60,
80,
100
]
},
"x": [
1,
2,
3,
4
],
"type": "scatter",
"mode": "markers",
"y": [
10,
11,
12,
13
]
}
],
"layout": {}
}
},
"metadata": {}
}
],
"execution_count": 8,
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"source": [
"import plotly.plotly as py\n",
"import plotly.graph_objs as go\n",
"\n",
"import pandas as pd\n",
"import math\n",
"\n",
"data = pd.read_csv(\"https://raw.githubusercontent.com/plotly/datasets/master/gapminderDataFiveYear.csv\")\n",
"df_2007 = data[data['year']==2007]\n",
"df_2007 = df_2007.sort_values(['continent', 'country'])\n",
"slope = 2.666051223553066e-05\n",
"hover_text = []\n",
"bubble_size = []\n",
"\n",
"for index, row in df_2007.iterrows():\n",
" hover_text.append(('Country: {country}<br>'+\n",
" 'Life Expectancy: {lifeExp}<br>'+\n",
" 'GDP per capita: {gdp}<br>'+\n",
" 'Population: {pop}<br>'+\n",
" 'Year: {year}').format(country=row['country'],\n",
" lifeExp=row['lifeExp'],\n",
" gdp=row['gdpPercap'],\n",
" pop=row['pop'],\n",
" year=row['year']))\n",
" bubble_size.append(math.sqrt(row['pop']*slope))\n",
" \n",
"df_2007['text'] = hover_text\n",
"df_2007['size'] = bubble_size\n",
"\n",
"trace0 = go.Scatter(\n",
" x=df_2007['gdpPercap'][df_2007['continent'] == 'Africa'],\n",
" y=df_2007['lifeExp'][df_2007['continent'] == 'Africa'],\n",
" mode='markers',\n",
" name='Africa',\n",
" text=df_2007['text'][df_2007['continent'] == 'Africa'],\n",
" marker=dict(\n",
" symbol='circle',\n",
" sizemode='diameter',\n",
" sizeref=0.85,\n",
" size=df_2007['size'][df_2007['continent'] == 'Africa'],\n",
" line=dict(\n",
" width=2\n",
" ),\n",
" )\n",
")\n",
"trace1 = go.Scatter(\n",
" x=df_2007['gdpPercap'][df_2007['continent'] == 'Americas'],\n",
" y=df_2007['lifeExp'][df_2007['continent'] == 'Americas'],\n",
" mode='markers',\n",
" name='Americas',\n",
" text=df_2007['text'][df_2007['continent'] == 'Americas'],\n",
" marker=dict(\n",
" sizemode='diameter',\n",
" sizeref=0.85,\n",
" size=df_2007['size'][df_2007['continent'] == 'Americas'],\n",
" line=dict(\n",
" width=2\n",
" ),\n",
" )\n",
")\n",
"trace2 = go.Scatter(\n",
" x=df_2007['gdpPercap'][df_2007['continent'] == 'Asia'],\n",
" y=df_2007['lifeExp'][df_2007['continent'] == 'Asia'],\n",
" mode='markers',\n",
" name='Asia',\n",
" text=df_2007['text'][df_2007['continent'] == 'Asia'],\n",
" marker=dict(\n",
" sizemode='diameter',\n",
" sizeref=0.85,\n",
" size=df_2007['size'][df_2007['continent'] == 'Asia'],\n",
" line=dict(\n",
" width=2\n",
" ),\n",
" )\n",
")\n",
"trace3 = go.Scatter(\n",
" x=df_2007['gdpPercap'][df_2007['continent'] == 'Europe'],\n",
" y=df_2007['lifeExp'][df_2007['continent'] == 'Europe'],\n",
" mode='markers',\n",
" name='Europe',\n",
" text=df_2007['text'][df_2007['continent'] == 'Europe'],\n",
" marker=dict(\n",
" sizemode='diameter',\n",
" sizeref=0.85,\n",
" size=df_2007['size'][df_2007['continent'] == 'Europe'],\n",
" line=dict(\n",
" width=2\n",
" ),\n",
" )\n",
")\n",
"trace4 = go.Scatter(\n",
" x=df_2007['gdpPercap'][df_2007['continent'] == 'Oceania'],\n",
" y=df_2007['lifeExp'][df_2007['continent'] == 'Oceania'],\n",
" mode='markers',\n",
" name='Oceania',\n",
" text=df_2007['text'][df_2007['continent'] == 'Oceania'],\n",
" marker=dict(\n",
" sizemode='diameter',\n",
" sizeref=0.85,\n",
" size=df_2007['size'][df_2007['continent'] == 'Oceania'],\n",
" line=dict(\n",
" width=2\n",
" ),\n",
" )\n",
")\n",
"\n",
"data = [trace0, trace1, trace2, trace3, trace4]\n",
"layout = go.Layout(\n",
" title='Life Expectancy v. Per Capita GDP, 2007',\n",
" xaxis=dict(\n",
" title='GDP per capita (2000 dollars)',\n",
" gridcolor='rgb(255, 255, 255)',\n",
" range=[2.003297660701705, 5.191505530708712],\n",
" type='log',\n",
" zerolinewidth=1,\n",
" ticklen=5,\n",
" gridwidth=2,\n",
" ),\n",
" yaxis=dict(\n",
" title='Life Expectancy (years)',\n",
" gridcolor='rgb(255, 255, 255)',\n",
" range=[36.12621671352166, 91.72921793264332],\n",
" zerolinewidth=1,\n",
" ticklen=5,\n",
" gridwidth=2,\n",
" ),\n",
" paper_bgcolor='rgb(243, 243, 243)',\n",
" plot_bgcolor='rgb(243, 243, 243)',\n",
")\n",
"\n",
"fig = go.Figure(data=data, layout=layout)\n",
"fig.layout.height = 1000\n",
"plotize(fig.data, fig.layout)"
],
"outputs": [
{
"output_type": "display_data",
"data": {
"application/vnd.plotly.v1+json": {
"data": [
{
"name": "Africa",
"text": [
"Country: Algeria<br>Life Expectancy: 72.301<br>GDP per capita: 6223.367465<br>Population: 33333216.0<br>Year: 2007",
"Country: Angola<br>Life Expectancy: 42.731<br>GDP per capita: 4797.231267<br>Population: 12420476.0<br>Year: 2007",
"Country: Benin<br>Life Expectancy: 56.728<br>GDP per capita: 1441.284873<br>Population: 8078314.0<br>Year: 2007",
"Country: Botswana<br>Life Expectancy: 50.728<br>GDP per capita: 12569.85177<br>Population: 1639131.0<br>Year: 2007",
"Country: Burkina Faso<br>Life Expectancy: 52.295<br>GDP per capita: 1217.032994<br>Population: 14326203.0<br>Year: 2007",
"Country: Burundi<br>Life Expectancy: 49.58<br>GDP per capita: 430.0706916<br>Population: 8390505.0<br>Year: 2007",
"Country: Cameroon<br>Life Expectancy: 50.43<br>GDP per capita: 2042.09524<br>Population: 17696293.0<br>Year: 2007",
"Country: Central African Republic<br>Life Expectancy: 44.741<br>GDP per capita: 706.016537<br>Population: 4369038.0<br>Year: 2007",
"Country: Chad<br>Life Expectancy: 50.651<br>GDP per capita: 1704.063724<br>Population: 10238807.0<br>Year: 2007",
"Country: Comoros<br>Life Expectancy: 65.152<br>GDP per capita: 986.1478792<br>Population: 710960.0<br>Year: 2007",
"Country: Congo, Dem. Rep.<br>Life Expectancy: 46.462<br>GDP per capita: 277.5518587<br>Population: 64606759.0<br>Year: 2007",
"Country: Congo, Rep.<br>Life Expectancy: 55.322<br>GDP per capita: 3632.557798<br>Population: 3800610.0<br>Year: 2007",
"Country: Cote d'Ivoire<br>Life Expectancy: 48.328<br>GDP per capita: 1544.750112<br>Population: 18013409.0<br>Year: 2007",
"Country: Djibouti<br>Life Expectancy: 54.791<br>GDP per capita: 2082.481567<br>Population: 496374.0<br>Year: 2007",
"Country: Egypt<br>Life Expectancy: 71.338<br>GDP per capita: 5581.180998<br>Population: 80264543.0<br>Year: 2007",
"Country: Equatorial Guinea<br>Life Expectancy: 51.579<br>GDP per capita: 12154.08975<br>Population: 551201.0<br>Year: 2007",
"Country: Eritrea<br>Life Expectancy: 58.04<br>GDP per capita: 641.3695236<br>Population: 4906585.0<br>Year: 2007",
"Country: Ethiopia<br>Life Expectancy: 52.947<br>GDP per capita: 690.8055759<br>Population: 76511887.0<br>Year: 2007",
"Country: Gabon<br>Life Expectancy: 56.735<br>GDP per capita: 13206.48452<br>Population: 1454867.0<br>Year: 2007",
"Country: Gambia<br>Life Expectancy: 59.448<br>GDP per capita: 752.7497265<br>Population: 1688359.0<br>Year: 2007",
"Country: Ghana<br>Life Expectancy: 60.022<br>GDP per capita: 1327.60891<br>Population: 22873338.0<br>Year: 2007",
"Country: Guinea<br>Life Expectancy: 56.007<br>GDP per capita: 942.6542111<br>Population: 9947814.0<br>Year: 2007",
"Country: Guinea-Bissau<br>Life Expectancy: 46.388<br>GDP per capita: 579.231743<br>Population: 1472041.0<br>Year: 2007",
"Country: Kenya<br>Life Expectancy: 54.11<br>GDP per capita: 1463.249282<br>Population: 35610177.0<br>Year: 2007",
"Country: Lesotho<br>Life Expectancy: 42.592<br>GDP per capita: 1569.331442<br>Population: 2012649.0<br>Year: 2007",
"Country: Liberia<br>Life Expectancy: 45.678<br>GDP per capita: 414.5073415<br>Population: 3193942.0<br>Year: 2007",
"Country: Libya<br>Life Expectancy: 73.952<br>GDP per capita: 12057.49928<br>Population: 6036914.0<br>Year: 2007",
"Country: Madagascar<br>Life Expectancy: 59.443<br>GDP per capita: 1044.770126<br>Population: 19167654.0<br>Year: 2007",
"Country: Malawi<br>Life Expectancy: 48.303<br>GDP per capita: 759.3499101<br>Population: 13327079.0<br>Year: 2007",
"Country: Mali<br>Life Expectancy: 54.467<br>GDP per capita: 1042.581557<br>Population: 12031795.0<br>Year: 2007",
"Country: Mauritania<br>Life Expectancy: 64.164<br>GDP per capita: 1803.151496<br>Population: 3270065.0<br>Year: 2007",
"Country: Mauritius<br>Life Expectancy: 72.801<br>GDP per capita: 10956.99112<br>Population: 1250882.0<br>Year: 2007",
"Country: Morocco<br>Life Expectancy: 71.164<br>GDP per capita: 3820.17523<br>Population: 33757175.0<br>Year: 2007",
"Country: Mozambique<br>Life Expectancy: 42.082<br>GDP per capita: 823.6856205<br>Population: 19951656.0<br>Year: 2007",
"Country: Namibia<br>Life Expectancy: 52.906<br>GDP per capita: 4811.060429<br>Population: 2055080.0<br>Year: 2007",
"Country: Niger<br>Life Expectancy: 56.867<br>GDP per capita: 619.6768924<br>Population: 12894865.0<br>Year: 2007",
"Country: Nigeria<br>Life Expectancy: 46.859<br>GDP per capita: 2013.977305<br>Population: 135031164.0<br>Year: 2007",
"Country: Reunion<br>Life Expectancy: 76.442<br>GDP per capita: 7670.122558<br>Population: 798094.0<br>Year: 2007",
"Country: Rwanda<br>Life Expectancy: 46.242<br>GDP per capita: 863.0884639<br>Population: 8860588.0<br>Year: 2007",
"Country: Sao Tome and Principe<br>Life Expectancy: 65.528<br>GDP per capita: 1598.435089<br>Population: 199579.0<br>Year: 2007",
"Country: Senegal<br>Life Expectancy: 63.062<br>GDP per capita: 1712.472136<br>Population: 12267493.0<br>Year: 2007",
"Country: Sierra Leone<br>Life Expectancy: 42.568<br>GDP per capita: 862.5407561<br>Population: 6144562.0<br>Year: 2007",
"Country: Somalia<br>Life Expectancy: 48.159<br>GDP per capita: 926.1410683<br>Population: 9118773.0<br>Year: 2007",
"Country: South Africa<br>Life Expectancy: 49.339<br>GDP per capita: 9269.657808<br>Population: 43997828.0<br>Year: 2007",
"Country: Sudan<br>Life Expectancy: 58.556<br>GDP per capita: 2602.394995<br>Population: 42292929.0<br>Year: 2007",
"Country: Swaziland<br>Life Expectancy: 39.613<br>GDP per capita: 4513.480643<br>Population: 1133066.0<br>Year: 2007",
"Country: Tanzania<br>Life Expectancy: 52.517<br>GDP per capita: 1107.482182<br>Population: 38139640.0<br>Year: 2007",
"Country: Togo<br>Life Expectancy: 58.42<br>GDP per capita: 882.9699438<br>Population: 5701579.0<br>Year: 2007",
"Country: Tunisia<br>Life Expectancy: 73.923<br>GDP per capita: 7092.923025<br>Population: 10276158.0<br>Year: 2007",
"Country: Uganda<br>Life Expectancy: 51.542<br>GDP per capita: 1056.380121<br>Population: 29170398.0<br>Year: 2007",
"Country: Zambia<br>Life Expectancy: 42.384<br>GDP per capita: 1271.211593<br>Population: 11746035.0<br>Year: 2007",
"Country: Zimbabwe<br>Life Expectancy: 43.487<br>GDP per capita: 469.7092981<br>Population: 12311143.0<br>Year: 2007"
],
"marker": {
"sizemode": "diameter",
"size": [
29.810746602820707,
18.19714956714691,
14.67555754441577,
6.610603004351237,
19.54338533545803,
14.956442130894004,
21.72077890062959,
10.792626698653965,
16.521859438354298,
4.353683242838514,
41.502401000634656,
10.066092062338798,
21.914531960507805,
3.6377994860078937,
46.2589864862037,
3.833445056960741,
11.437310410545445,
45.164655423539315,
6.227961099314107,
6.709136738617593,
24.6944307003913,
16.2853866046767,
6.2646122858244615,
30.8121008634256,
7.325179403286212,
9.227791164226424,
12.686497529335918,
22.605739846185486,
18.849582296257488,
17.91015962555601,
9.337109185582044,
5.774872714286009,
29.99972628415882,
23.063420581238567,
7.4019919943886965,
18.541405181593333,
59.99999999999956,
4.612764339536934,
15.369704446995593,
2.3067029222366227,
18.084735199216677,
12.799108187017435,
15.592022291528659,
34.249155197329664,
33.57902844158731,
5.496191404660484,
31.88765182447172,
12.329112567064373,
16.55196774082303,
27.887232791983845,
17.696194784090487,
18.116881039099077
],
"line": {
"width": 2
},
"symbol": "circle",
"sizeref": 0.85
},
"mode": "markers",
"y": [
72.301,
42.731,
56.728,
50.728,
52.295,
49.58,
50.43,
44.74100000000001,
50.651,
65.152,
46.461999999999996,
55.321999999999996,
48.328,
54.791000000000004,
71.33800000000001,
51.57899999999999,
58.04,
52.946999999999996,
56.735,
59.448,
60.022,
56.007,
46.388000000000005,
54.11,
42.592,
45.678000000000004,
73.952,
59.443000000000005,
48.303000000000004,
54.467,
64.164,
72.801,
71.164,
42.082,
52.906000000000006,
56.867,
46.858999999999995,
76.442,
46.242,
65.528,
63.062,
42.568000000000005,
48.159,
49.339,
58.556000000000004,
39.613,
52.516999999999996,
58.42,
73.923,
51.542,
42.38399999999999,
43.486999999999995
],
"x": [
6223.367465,
4797.231267,
1441.284873,
12569.851770000001,
1217.032994,
430.07069160000003,
2042.0952399999999,
706.016537,
1704.0637239999999,
986.1478792000001,
277.55185869999997,
3632.557798,
1544.750112,
2082.4815670000003,
5581.180998,
12154.08975,
641.3695236000001,
690.8055759,
13206.48452,
752.7497265,
1327.60891,
942.6542111,
579.2317429999999,
1463.249282,
1569.331442,
414.5073415,
12057.49928,
1044.770126,
759.3499101,
1042.581557,
1803.1514960000002,
10956.99112,
3820.17523,
823.6856205,
4811.060429,
619.6768923999999,
2013.9773050000001,
7670.122558,
863.0884639000001,
1598.435089,
1712.4721359999999,
862.5407561000001,
926.1410683,
9269.657808,
2602.394995,
4513.480643,
1107.482182,
882.9699437999999,
7092.923025,
1056.3801210000001,
1271.211593,
469.70929810000007
],
"type": "scatter",
"uid": "e135b5a5-2326-486c-bdbc-509171174f46"
},
{
"name": "Americas",
"text": [
"Country: Argentina<br>Life Expectancy: 75.32<br>GDP per capita: 12779.37964<br>Population: 40301927.0<br>Year: 2007",
"Country: Bolivia<br>Life Expectancy: 65.554<br>GDP per capita: 3822.137084<br>Population: 9119152.0<br>Year: 2007",
"Country: Brazil<br>Life Expectancy: 72.39<br>GDP per capita: 9065.800825<br>Population: 190010647.0<br>Year: 2007",
"Country: Canada<br>Life Expectancy: 80.653<br>GDP per capita: 36319.23501<br>Population: 33390141.0<br>Year: 2007",
"Country: Chile<br>Life Expectancy: 78.553<br>GDP per capita: 13171.63885<br>Population: 16284741.0<br>Year: 2007",
"Country: Colombia<br>Life Expectancy: 72.889<br>GDP per capita: 7006.580419<br>Population: 44227550.0<br>Year: 2007",
"Country: Costa Rica<br>Life Expectancy: 78.782<br>GDP per capita: 9645.06142<br>Population: 4133884.0<br>Year: 2007",
"Country: Cuba<br>Life Expectancy: 78.273<br>GDP per capita: 8948.102923<br>Population: 11416987.0<br>Year: 2007",
"Country: Dominican Republic<br>Life Expectancy: 72.235<br>GDP per capita: 6025.374752<br>Population: 9319622.0<br>Year: 2007",
"Country: Ecuador<br>Life Expectancy: 74.994<br>GDP per capita: 6873.262326<br>Population: 13755680.0<br>Year: 2007",
"Country: El Salvador<br>Life Expectancy: 71.878<br>GDP per capita: 5728.353514<br>Population: 6939688.0<br>Year: 2007",
"Country: Guatemala<br>Life Expectancy: 70.259<br>GDP per capita: 5186.050003<br>Population: 12572928.0<br>Year: 2007",
"Country: Haiti<br>Life Expectancy: 60.916<br>GDP per capita: 1201.637154<br>Population: 8502814.0<br>Year: 2007",
"Country: Honduras<br>Life Expectancy: 70.198<br>GDP per capita: 3548.330846<br>Population: 7483763.0<br>Year: 2007",
"Country: Jamaica<br>Life Expectancy: 72.567<br>GDP per capita: 7320.880262<br>Population: 2780132.0<br>Year: 2007",
"Country: Mexico<br>Life Expectancy: 76.195<br>GDP per capita: 11977.57496<br>Population: 108700891.0<br>Year: 2007",
"Country: Nicaragua<br>Life Expectancy: 72.899<br>GDP per capita: 2749.320965<br>Population: 5675356.0<br>Year: 2007",
"Country: Panama<br>Life Expectancy: 75.537<br>GDP per capita: 9809.185636<br>Population: 3242173.0<br>Year: 2007",
"Country: Paraguay<br>Life Expectancy: 71.752<br>GDP per capita: 4172.838464<br>Population: 6667147.0<br>Year: 2007",
"Country: Peru<br>Life Expectancy: 71.421<br>GDP per capita: 7408.905561<br>Population: 28674757.0<br>Year: 2007",
"Country: Puerto Rico<br>Life Expectancy: 78.746<br>GDP per capita: 19328.70901<br>Population: 3942491.0<br>Year: 2007",
"Country: Trinidad and Tobago<br>Life Expectancy: 69.819<br>GDP per capita: 18008.50924<br>Population: 1056608.0<br>Year: 2007",
"Country: United States<br>Life Expectancy: 78.242<br>GDP per capita: 42951.65309<br>Population: 301139947.0<br>Year: 2007",
"Country: Uruguay<br>Life Expectancy: 76.384<br>GDP per capita: 10611.46299<br>Population: 3447496.0<br>Year: 2007",
"Country: Venezuela<br>Life Expectancy: 73.747<br>GDP per capita: 11415.80569<br>Population: 26084662.0<br>Year: 2007"
],
"marker": {
"sizemode": "diameter",
"sizeref": 0.85,
"line": {
"width": 2
},
"size": [
32.779109473854895,
15.592346310727706,
71.17430139611204,
29.83619048532493,
20.83649530710354,
34.338449847402025,
10.498164837830679,
17.446567616766185,
15.762801031590824,
19.150286550024372,
13.60204531806762,
18.30848712429419,
15.056207247625194,
14.125188672343873,
8.609282386029065,
53.83327441758103,
12.300727542669675,
9.297203500849443,
13.33227490601591,
27.649298541723773,
10.252259728663214,
5.307514532449212,
89.60214975992794,
9.587075116527616,
26.371015346601308
]
},
"mode": "markers",
"y": [
75.32,
65.554,
72.39,
80.653,
78.553,
72.889,
78.782,
78.273,
72.235,
74.994,
71.878,
70.259,
60.916000000000004,
70.19800000000001,
72.567,
76.195,
72.899,
75.53699999999999,
71.752,
71.421,
78.74600000000001,
69.819,
78.242,
76.384,
73.747
],
"x": [
12779.379640000001,
3822.1370840000004,
9065.800825,
36319.235010000004,
13171.63885,
7006.580419,
9645.06142,
8948.102923,
6025.374752000001,
6873.262326000001,
5728.353514,
5186.050003,
1201.637154,
3548.3308460000003,
7320.880262000001,
11977.57496,
2749.320965,
9809.185636,
4172.838464,
7408.905561,
19328.70901,
18008.50924,
42951.65309,
10611.46299,
11415.805690000001
],
"type": "scatter",
"uid": "6f3171a9-462b-4376-ba81-1c0786b11f07"
},
{
"name": "Asia",
"text": [
"Country: Afghanistan<br>Life Expectancy: 43.828<br>GDP per capita: 974.5803384<br>Population: 31889923.0<br>Year: 2007",
"Country: Bahrain<br>Life Expectancy: 75.635<br>GDP per capita: 29796.04834<br>Population: 708573.0<br>Year: 2007",
"Country: Bangladesh<br>Life Expectancy: 64.062<br>GDP per capita: 1391.253792<br>Population: 150448339.0<br>Year: 2007",
"Country: Cambodia<br>Life Expectancy: 59.723<br>GDP per capita: 1713.778686<br>Population: 14131858.0<br>Year: 2007",
"Country: China<br>Life Expectancy: 72.961<br>GDP per capita: 4959.114854<br>Population: 1318683096.0<br>Year: 2007",
"Country: Hong Kong, China<br>Life Expectancy: 82.208<br>GDP per capita: 39724.97867<br>Population: 6980412.0<br>Year: 2007",
"Country: India<br>Life Expectancy: 64.698<br>GDP per capita: 2452.210407<br>Population: 1110396331.0<br>Year: 2007",
"Country: Indonesia<br>Life Expectancy: 70.65<br>GDP per capita: 3540.651564<br>Population: 223547000.0<br>Year: 2007",
"Country: Iran<br>Life Expectancy: 70.964<br>GDP per capita: 11605.71449<br>Population: 69453570.0<br>Year: 2007",
"Country: Iraq<br>Life Expectancy: 59.545<br>GDP per capita: 4471.061906<br>Population: 27499638.0<br>Year: 2007",
"Country: Israel<br>Life Expectancy: 80.745<br>GDP per capita: 25523.2771<br>Population: 6426679.0<br>Year: 2007",
"Country: Japan<br>Life Expectancy: 82.603<br>GDP per capita: 31656.06806<br>Population: 127467972.0<br>Year: 2007",
"Country: Jordan<br>Life Expectancy: 72.535<br>GDP per capita: 4519.461171<br>Population: 6053193.0<br>Year: 2007",
"Country: Korea, Dem. Rep.<br>Life Expectancy: 67.297<br>GDP per capita: 1593.06548<br>Population: 23301725.0<br>Year: 2007",
"Country: Korea, Rep.<br>Life Expectancy: 78.623<br>GDP per capita: 23348.13973<br>Population: 49044790.0<br>Year: 2007",
"Country: Kuwait<br>Life Expectancy: 77.588<br>GDP per capita: 47306.98978<br>Population: 2505559.0<br>Year: 2007",
"Country: Lebanon<br>Life Expectancy: 71.993<br>GDP per capita: 10461.05868<br>Population: 3921278.0<br>Year: 2007",
"Country: Malaysia<br>Life Expectancy: 74.241<br>GDP per capita: 12451.6558<br>Population: 24821286.0<br>Year: 2007",
"Country: Mongolia<br>Life Expectancy: 66.803<br>GDP per capita: 3095.772271<br>Population: 2874127.0<br>Year: 2007",
"Country: Myanmar<br>Life Expectancy: 62.069<br>GDP per capita: 944.0<br>Population: 47761980.0<br>Year: 2007",
"Country: Nepal<br>Life Expectancy: 63.785<br>GDP per capita: 1091.359778<br>Population: 28901790.0<br>Year: 2007",
"Country: Oman<br>Life Expectancy: 75.64<br>GDP per capita: 22316.19287<br>Population: 3204897.0<br>Year: 2007",
"Country: Pakistan<br>Life Expectancy: 65.483<br>GDP per capita: 2605.94758<br>Population: 169270617.0<br>Year: 2007",
"Country: Philippines<br>Life Expectancy: 71.688<br>GDP per capita: 3190.481016<br>Population: 91077287.0<br>Year: 2007",
"Country: Saudi Arabia<br>Life Expectancy: 72.777<br>GDP per capita: 21654.83194<br>Population: 27601038.0<br>Year: 2007",
"Country: Singapore<br>Life Expectancy: 79.972<br>GDP per capita: 47143.17964<br>Population: 4553009.0<br>Year: 2007",
"Country: Sri Lanka<br>Life Expectancy: 72.396<br>GDP per capita: 3970.095407<br>Population: 20378239.0<br>Year: 2007",
"Country: Syria<br>Life Expectancy: 74.143<br>GDP per capita: 4184.548089<br>Population: 19314747.0<br>Year: 2007",
"Country: Taiwan<br>Life Expectancy: 78.4<br>GDP per capita: 28718.27684<br>Population: 23174294.0<br>Year: 2007",
"Country: Thailand<br>Life Expectancy: 70.616<br>GDP per capita: 7458.396327<br>Population: 65068149.0<br>Year: 2007",
"Country: Vietnam<br>Life Expectancy: 74.249<br>GDP per capita: 2441.576404<br>Population: 85262356.0<br>Year: 2007",
"Country: West Bank and Gaza<br>Life Expectancy: 73.422<br>GDP per capita: 3025.349798<br>Population: 4018332.0<br>Year: 2007",
"Country: Yemen, Rep.<br>Life Expectancy: 62.698<br>GDP per capita: 2280.769906<br>Population: 22211743.0<br>Year: 2007"
],
"marker": {
"sizemode": "diameter",
"sizeref": 0.85,
"line": {
"width": 2
},
"size": [
29.158218092531488,
4.346368499824499,
63.33269126387071,
19.410372822791988,
187.50137817012293,
13.641897211716744,
172.05735953138958,
77.2002430612506,
43.0310092001836,
27.076824691452725,
13.089635369762137,
58.295466608856294,
12.703591068691109,
24.924604800707886,
36.1601883828615,
8.173095275129489,
10.224640829775742,
25.724466935285673,
8.753610572213562,
35.684154076889236,
27.75853969364631,
9.243602959999716,
67.17768495299852,
49.27643579280504,
27.126699233639663,
11.01751115964859,
23.308674140715684,
22.692312546756426,
24.85635831606844,
41.65033232229764,
47.677437906919565,
10.350400448892032,
24.33467579451106
]
},
"mode": "markers",
"y": [
43.828,
75.635,
64.062,
59.723,
72.961,
82.208,
64.69800000000001,
70.65,
70.964,
59.545,
80.745,
82.603,
72.535,
67.297,
78.623,
77.58800000000001,
71.993,
74.241,
66.803,
62.068999999999996,
63.785,
75.64,
65.483,
71.688,
72.777,
79.972,
72.396,
74.143,
78.4,
70.616,
74.249,
73.422,
62.698
],
"x": [
974.5803384,
29796.048339999998,
1391.253792,
1713.7786859999999,
4959.1148539999995,
39724.97867,
2452.210407,
3540.6515640000002,
11605.71449,
4471.061906,
25523.2771,
31656.06806,
4519.461171,
1593.06548,
23348.139730000003,
47306.98978,
10461.05868,
12451.6558,
3095.7722710000003,
944,
1091.359778,
22316.19287,
2605.94758,
3190.481016,
21654.83194,
47143.179639999995,
3970.0954070000003,
4184.548089,
28718.27684,
7458.3963269999995,
2441.576404,
3025.349798,
2280.769906
],
"type": "scatter",
"uid": "d7f0b562-84ce-4757-b5ca-ed934271b9fb"
},
{
"name": "Europe",
"text": [
"Country: Albania<br>Life Expectancy: 76.423<br>GDP per capita: 5937.029526<br>Population: 3600523.0<br>Year: 2007",
"Country: Austria<br>Life Expectancy: 79.829<br>GDP per capita: 36126.4927<br>Population: 8199783.0<br>Year: 2007",
"Country: Belgium<br>Life Expectancy: 79.441<br>GDP per capita: 33692.60508<br>Population: 10392226.0<br>Year: 2007",
"Country: Bosnia and Herzegovina<br>Life Expectancy: 74.852<br>GDP per capita: 7446.298803<br>Population: 4552198.0<br>Year: 2007",
"Country: Bulgaria<br>Life Expectancy: 73.005<br>GDP per capita: 10680.79282<br>Population: 7322858.0<br>Year: 2007",
"Country: Croatia<br>Life Expectancy: 75.748<br>GDP per capita: 14619.22272<br>Population: 4493312.0<br>Year: 2007",
"Country: Czech Republic<br>Life Expectancy: 76.486<br>GDP per capita: 22833.30851<br>Population: 10228744.0<br>Year: 2007",
"Country: Denmark<br>Life Expectancy: 78.332<br>GDP per capita: 35278.41874<br>Population: 5468120.0<br>Year: 2007",
"Country: Finland<br>Life Expectancy: 79.313<br>GDP per capita: 33207.0844<br>Population: 5238460.0<br>Year: 2007",
"Country: France<br>Life Expectancy: 80.657<br>GDP per capita: 30470.0167<br>Population: 61083916.0<br>Year: 2007",
"Country: Germany<br>Life Expectancy: 79.406<br>GDP per capita: 32170.37442<br>Population: 82400996.0<br>Year: 2007",
"Country: Greece<br>Life Expectancy: 79.483<br>GDP per capita: 27538.41188<br>Population: 10706290.0<br>Year: 2007",
"Country: Hungary<br>Life Expectancy: 73.338<br>GDP per capita: 18008.94444<br>Population: 9956108.0<br>Year: 2007",
"Country: Iceland<br>Life Expectancy: 81.757<br>GDP per capita: 36180.78919<br>Population: 301931.0<br>Year: 2007",
"Country: Ireland<br>Life Expectancy: 78.885<br>GDP per capita: 40675.99635<br>Population: 4109086.0<br>Year: 2007",
"Country: Italy<br>Life Expectancy: 80.546<br>GDP per capita: 28569.7197<br>Population: 58147733.0<br>Year: 2007",
"Country: Montenegro<br>Life Expectancy: 74.543<br>GDP per capita: 9253.896111<br>Population: 684736.0<br>Year: 2007",
"Country: Netherlands<br>Life Expectancy: 79.762<br>GDP per capita: 36797.93332<br>Population: 16570613.0<br>Year: 2007",
"Country: Norway<br>Life Expectancy: 80.196<br>GDP per capita: 49357.19017<br>Population: 4627926.0<br>Year: 2007",
"Country: Poland<br>Life Expectancy: 75.563<br>GDP per capita: 15389.92468<br>Population: 38518241.0<br>Year: 2007",
"Country: Portugal<br>Life Expectancy: 78.098<br>GDP per capita: 20509.64777<br>Population: 10642836.0<br>Year: 2007",
"Country: Romania<br>Life Expectancy: 72.476<br>GDP per capita: 10808.47561<br>Population: 22276056.0<br>Year: 2007",
"Country: Serbia<br>Life Expectancy: 74.002<br>GDP per capita: 9786.534714<br>Population: 10150265.0<br>Year: 2007",
"Country: Slovak Republic<br>Life Expectancy: 74.663<br>GDP per capita: 18678.31435<br>Population: 5447502.0<br>Year: 2007",
"Country: Slovenia<br>Life Expectancy: 77.926<br>GDP per capita: 25768.25759<br>Population: 2009245.0<br>Year: 2007",
"Country: Spain<br>Life Expectancy: 80.941<br>GDP per capita: 28821.0637<br>Population: 40448191.0<br>Year: 2007",
"Country: Sweden<br>Life Expectancy: 80.884<br>GDP per capita: 33859.74835<br>Population: 9031088.0<br>Year: 2007",
"Country: Switzerland<br>Life Expectancy: 81.701<br>GDP per capita: 37506.41907<br>Population: 7554661.0<br>Year: 2007",
"Country: Turkey<br>Life Expectancy: 71.777<br>GDP per capita: 8458.276384<br>Population: 71158647.0<br>Year: 2007",
"Country: United Kingdom<br>Life Expectancy: 79.425<br>GDP per capita: 33203.26128<br>Population: 60776238.0<br>Year: 2007"
],
"marker": {
"sizemode": "diameter",
"sizeref": 0.85,
"line": {
"width": 2
},
"size": [
9.797539869569787,
14.78547987047415,
16.645181537832496,
11.016529874582023,
13.972513922270881,
10.945044520423695,
16.513738358291583,
12.074058148168325,
11.817784349248296,
40.35503054034437,
46.87059592194143,
16.894826887013064,
16.292174168976487,
2.837187889404931,
10.466629714471022,
39.37319325524499,
4.272635311620724,
21.018587741252823,
11.107784556252902,
32.04553066297419,
16.844686384695507,
24.36988025303707,
16.45026638770262,
12.051273531211452,
7.318982231613819,
32.83853667660271,
15.516875720458488,
14.191938980484178,
43.556009677279974,
40.25326864775733
]
},
"mode": "markers",
"y": [
76.423,
79.829,
79.441,
74.852,
73.005,
75.748,
76.486,
78.332,
79.313,
80.657,
79.406,
79.483,
73.33800000000001,
81.757,
78.885,
80.546,
74.543,
79.762,
80.196,
75.563,
78.098,
72.476,
74.002,
74.663,
77.926,
80.941,
80.884,
81.70100000000001,
71.777,
79.425
],
"x": [
5937.029525999999,
36126.4927,
33692.60508,
7446.298803,
10680.79282,
14619.222719999998,
22833.30851,
35278.41874,
33207.0844,
30470.0167,
32170.37442,
27538.41188,
18008.94444,
36180.789189999996,
40675.99635,
28569.7197,
9253.896111,
36797.93332,
49357.19017,
15389.924680000002,
20509.64777,
10808.47561,
9786.534714,
18678.31435,
25768.25759,
28821.0637,
33859.74835,
37506.419069999996,
8458.276384,
33203.26128
],
"type": "scatter",
"uid": "e036bd9e-6104-49c0-a9fa-dfb4e8304ef4"
},
{
"name": "Oceania",
"text": [
"Country: Australia<br>Life Expectancy: 81.235<br>GDP per capita: 34435.36744<br>Population: 20434176.0<br>Year: 2007",
"Country: New Zealand<br>Life Expectancy: 80.204<br>GDP per capita: 25185.00911<br>Population: 4115771.0<br>Year: 2007"
],
"marker": {
"sizemode": "diameter",
"sizeref": 0.85,
"line": {
"width": 2
},
"size": [
23.34064264905718,
10.475140242695668
]
},
"mode": "markers",
"y": [
81.235,
80.204
],
"x": [
34435.367439999995,
25185.00911
],
"type": "scatter",
"uid": "f7cabf72-d49a-4b55-a094-dbac8ebec4c1"
}
],
"layout": {
"title": {
"text": "Life Expectancy v. Per Capita GDP, 2007"
},
"paper_bgcolor": "rgb(243, 243, 243)",
"plot_bgcolor": "rgb(243, 243, 243)",
"yaxis": {
"title": {
"text": "Life Expectancy (years)"
},
"zerolinewidth": 1,
"ticklen": 5,
"gridwidth": 2,
"range": [
36.12621671352166,
91.72921793264332
],
"gridcolor": "rgb(255, 255, 255)"
},
"height": 1000,
"xaxis": {
"title": {
"text": "GDP per capita (2000 dollars)"
},
"zerolinewidth": 1,
"ticklen": 5,
"gridwidth": 2,
"range": [
2.003297660701705,
5.191505530708712
],
"gridcolor": "rgb(255, 255, 255)",
"type": "log"
}
}
}
},
"metadata": {}
}
],
"execution_count": 9,
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"source": [
"df = pd.read_csv(\"https://raw.githubusercontent.com/plotly/datasets/master/gapminderDataFiveYear.csv\")\n",
"df.head()"
],
"outputs": [
{
"output_type": "execute_result",
"execution_count": 10,
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>country</th>\n",
" <th>year</th>\n",
" <th>pop</th>\n",
" <th>continent</th>\n",
" <th>lifeExp</th>\n",
" <th>gdpPercap</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Afghanistan</td>\n",
" <td>1952</td>\n",
" <td>8425333.0</td>\n",
" <td>Asia</td>\n",
" <td>28.801</td>\n",
" <td>779.445314</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Afghanistan</td>\n",
" <td>1957</td>\n",
" <td>9240934.0</td>\n",
" <td>Asia</td>\n",
" <td>30.332</td>\n",
" <td>820.853030</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Afghanistan</td>\n",
" <td>1962</td>\n",
" <td>10267083.0</td>\n",
" <td>Asia</td>\n",
" <td>31.997</td>\n",
" <td>853.100710</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Afghanistan</td>\n",
" <td>1967</td>\n",
" <td>11537966.0</td>\n",
" <td>Asia</td>\n",
" <td>34.020</td>\n",
" <td>836.197138</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Afghanistan</td>\n",
" <td>1972</td>\n",
" <td>13079460.0</td>\n",
" <td>Asia</td>\n",
" <td>36.088</td>\n",
" <td>739.981106</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" country year pop continent lifeExp gdpPercap\n",
"0 Afghanistan 1952 8425333.0 Asia 28.801 779.445314\n",
"1 Afghanistan 1957 9240934.0 Asia 30.332 820.853030\n",
"2 Afghanistan 1962 10267083.0 Asia 31.997 853.100710\n",
"3 Afghanistan 1967 11537966.0 Asia 34.020 836.197138\n",
"4 Afghanistan 1972 13079460.0 Asia 36.088 739.981106"
]
},
"metadata": {}
}
],
"execution_count": 10,
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"source": [
"data = [{'x': [1, 2], 'y': [3, 1]}]\n",
"layout = {'height': 1600}"
],
"outputs": [],
"execution_count": 11,
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"source": [
"plotize(data, layout)"
],
"outputs": [
{
"output_type": "display_data",
"data": {
"application/vnd.plotly.v1+json": {
"data": [
{
"y": [
3,
1
],
"x": [
1,
2
]
}
],
"layout": {
"height": 1600
}
}
},
"metadata": {}
}
],
"execution_count": 12,
"metadata": {
"collapsed": false
}
}
],
"metadata": {
"kernel_info": {
"name": "python3"
},
"kernelspec": {
"name": "python3",
"language": "python",
"display_name": "Python 3"
},
"language_info": {
"mimetype": "text/x-python",
"nbconvert_exporter": "python",
"name": "python",
"pygments_lexer": "ipython2",
"version": "2.7.15",
"file_extension": ".py",
"codemirror_mode": {
"version": 2,
"name": "ipython"
}
},
"title": "Gallery of Plotly Plots",
"nteract": {
"version": "[email protected]"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment