Created
January 30, 2015 21:26
-
-
Save jackparmer/4b9c3142a31e5c12988d to your computer and use it in GitHub Desktop.
ipython_3d_scatter_widget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:06246424bcbad603fff82c9486defe01de3ff31ab0b8afef346af09e651cc87e" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ | |
"cell_type": "heading", | |
"level": 1, | |
"metadata": {}, | |
"source": [ | |
"Dots on a helix" | |
] | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 5, | |
"metadata": {}, | |
"source": [ | |
"IPython widgets with 3d Plotly graphs" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"import plotly.plotly as py\n", | |
"from plotly.graph_objs import *\n", | |
"from plotly.widgets import GraphWidget\n", | |
"from IPython.display import display, HTML, Image\n", | |
"import numpy as np\n", | |
"import math\n", | |
"from IPython.html import widgets\n", | |
"import colorlover as cl" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 51 | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 5, | |
"metadata": {}, | |
"source": [ | |
"Widgets can't be displayed on nbviewer, but this is what you'll see if you download the notebook:" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"Image(url='http://i.imgur.com/CzMRuMo.gif')" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<img src=\"http://i.imgur.com/CzMRuMo.gif\"/>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 53, | |
"text": [ | |
"<IPython.core.display.Image at 0x1074e9310>" | |
] | |
} | |
], | |
"prompt_number": 53 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"z = np.arange(1,20,0.1)\n", | |
"x = np.cos(4*z)*( np.power(z+1,3) )\n", | |
"y = np.sin(4*z)*( np.power(z+1,3) )" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 26 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"colors = cl.interp( cl.scales['11']['div']['RdYlBu'], z)\n", | |
"HTML( cl.to_html( colors ) )" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<div style=\"background-color:hsl(173.762905528, 84.5684924623%, 41.1222467337%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(156.52101608, 83.0253417085%, 41.999181407%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(139.279126633, 81.4821909548%, 42.8761160804%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(122.037237186, 79.939040201%, 43.7530507538%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(104.795347739, 78.3958894472%, 44.6299854271%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(87.5534582915, 76.8527386935%, 45.5069201005%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(70.3115688442, 75.3095879397%, 46.3838547739%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(53.069679397, 73.7664371859%, 47.2607894472%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(35.8277899497, 72.2232864322%, 48.1377241206%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(18.5859005025, 70.6801356784%, 49.014658794%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(3.12432613065, 69.390060804%, 49.8600633166%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(3.68558743719, 70.3776688442%, 50.4216964824%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(4.24684874372, 71.3652768844%, 50.9833296482%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(4.80811005025, 72.3528849246%, 51.5449628141%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(5.36937135678, 73.3404929648%, 52.1065959799%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(5.93063266332, 74.328101005%, 52.6682291457%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(6.49189396985, 75.3157090452%, 53.2298623116%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(7.05315527638, 76.3033170854%, 53.7914954774%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(7.61441658291, 77.2909251256%, 54.3531286432%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(8.17567788945, 78.2785331658%, 54.914761809%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(8.73693919598, 79.266141206%, 55.4763949749%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(9.29820050251, 80.2537492462%, 56.0380281407%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(9.85946180905, 81.2413572864%, 56.5996613065%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(10.4207231156, 82.2289653266%, 57.1612944724%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(10.9819844221, 83.2165733668%, 57.7229276382%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(11.5432457286, 84.204181407%, 58.284560804%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(12.1045070352, 85.1917894472%, 58.8461939698%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(12.6657683417, 86.1793974874%, 59.4078271357%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(13.2270296482, 87.1670055276%, 59.9694603015%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(13.7882909548, 88.1546135678%, 60.5310934673%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(14.3918537688, 89.0306829146%, 61.0572552764%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(15.1646226131, 89.4605974874%, 61.4415316583%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(15.9373914573, 89.8905120603%, 61.8258080402%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(16.7101603015, 90.3204266332%, 62.2100844221%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(17.4829291457, 90.750341206%, 62.594360804%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(18.2556979899, 91.1802557789%, 62.9786371859%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(19.0284668342, 91.6101703518%, 63.3629135678%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(19.8012356784, 92.0400849246%, 63.7471899497%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(20.5740045226, 92.4699994975%, 64.1314663317%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(21.3467733668, 92.8999140704%, 64.5157427136%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(22.1195422111, 93.3298286432%, 64.9000190955%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(22.8923110553, 93.7597432161%, 65.2842954774%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(23.6650798995, 94.1896577889%, 65.6685718593%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(24.4378487437, 94.6195723618%, 66.0528482412%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(25.2106175879, 95.0494869347%, 66.4371246231%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(25.9833864322, 95.4794015075%, 66.821401005%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(26.7561552764, 95.9093160804%, 67.2056773869%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(27.5289241206, 96.3392306533%, 67.5899537688%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(28.3016929648, 96.7691452261%, 67.9742301508%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(29.074461809, 97.199059799%, 68.3585065327%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(29.8267718593, 97.5107683417%, 68.7693849246%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(30.5313447236, 97.5466628141%, 69.2423346734%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(31.2359175879, 97.5825572864%, 69.7152844221%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(31.9404904523, 97.6184517588%, 70.1882341709%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(32.6450633166, 97.6543462312%, 70.6611839196%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(33.3496361809, 97.6902407035%, 71.1341336683%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(34.0542090452, 97.7261351759%, 71.6070834171%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(34.7587819095, 97.7620296482%, 72.0800331658%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(35.4633547739, 97.7979241206%, 72.5529829146%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(36.1679276382, 97.833818593%, 73.0259326633%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(36.8725005025, 97.8697130653%, 73.4988824121%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(37.5770733668, 97.9056075377%, 73.9718321608%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(38.2816462312, 97.9415020101%, 74.4447819095%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(38.9862190955, 97.9773964824%, 74.9177316583%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(39.6907919598, 98.0132909548%, 75.390681407%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(40.3953648241, 98.0491854271%, 75.8636311558%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(41.0999376884, 98.0850798995%, 76.3365809045%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(41.8045105528, 98.1209743719%, 76.8095306533%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(42.5090834171, 98.1568688442%, 77.282480402%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(43.2136562814, 98.1927633166%, 77.7554301508%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(43.9653165829, 98.2501934673%, 78.2283819095%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(44.7876080402, 98.3399271357%, 78.7013366834%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(45.6098994975, 98.429660804%, 79.1742914573%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(46.4321909548, 98.5193944724%, 79.6472462312%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(47.2544824121, 98.6091281407%, 80.120201005%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(48.0767738693, 98.698861809%, 80.5931557789%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(48.8990653266, 98.7885954774%, 81.0661105528%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(49.7213567839, 98.8783291457%, 81.5390653266%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(50.5436482412, 98.9680628141%, 82.0120201005%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(51.3659396985, 99.0577964824%, 82.4849748744%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(52.1882311558, 99.1475301508%, 82.9579296482%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(53.0105226131, 99.2372638191%, 83.4308844221%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(53.8328140704, 99.3269974874%, 83.903839196%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(54.6551055276, 99.4167311558%, 84.3767939698%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(55.4773969849, 99.5064648241%, 84.8497487437%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(56.2996884422, 99.5961984925%, 85.3227035176%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(57.1219798995, 99.6859321608%, 85.7956582915%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(57.9442713568, 99.7756658291%, 86.2686130653%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(58.7665628141, 99.8653994975%, 86.7415678392%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(59.5888542714, 99.9551331658%, 87.2145226131%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(50.5830628141, 99.0743190955%, 87.5790904523%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(31.7491884422, 97.2229572864%, 87.8352713568%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(12.9153140704, 95.3715954774%, 88.0914522613%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-5.91856030151, 93.5202336683%, 88.3476331658%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-24.7524346734, 91.6688718593%, 88.6038140704%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-43.5863090452, 89.8175100503%, 88.8599949749%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-62.4201834171, 87.9661482412%, 89.1161758794%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-81.2540577889, 86.1147864322%, 89.3723567839%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-100.087932161, 84.2634246231%, 89.6285376884%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-118.921806533, 82.4120628141%, 89.884718593%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-137.755680905, 80.560701005%, 90.1408994975%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-156.589555276, 78.709339196%, 90.397080402%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-175.423429648, 76.8579773869%, 90.6532613065%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-194.25730402, 75.0066155779%, 90.9094422111%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-213.091178392, 73.1552537688%, 91.1656231156%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-231.925052764, 71.3038919598%, 91.4218040201%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-250.758927136, 69.4525301508%, 91.6779849246%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-269.592801508, 67.6011683417%, 91.9341658291%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-288.426675879, 65.7498065327%, 92.1903467337%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-307.260550251, 63.8984447236%, 92.4465276382%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-303.185173367, 63.0171773869%, 92.1469909548%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-283.836962312, 62.7826396985%, 91.4769758794%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-264.488751256, 62.5481020101%, 90.806960804%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-245.140540201, 62.3135643216%, 90.1369457286%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-225.792329146, 62.0790266332%, 89.4669306533%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-206.44411809, 61.8444889447%, 88.7969155779%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-187.095907035, 61.6099512563%, 88.1269005025%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-167.74769598, 61.3754135678%, 87.4568854271%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-148.399484925, 61.1408758794%, 86.7868703518%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-129.051273869, 60.906338191%, 86.1168552764%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-109.703062814, 60.6718005025%, 85.446840201%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-90.3548517588, 60.4372628141%, 84.7768251256%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-71.0066407035, 60.2027251256%, 84.1068100503%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-51.6584296482, 59.9681874372%, 83.4367949749%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-32.310218593, 59.7336497487%, 82.7667798995%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(-12.9620075377, 59.4991120603%, 82.0967648241%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(6.38620351759, 59.2645743719%, 81.4267497487%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(25.7344145729, 59.0300366834%, 80.7567346734%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(45.0826256281, 58.795498995%, 80.086719598%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(64.4308366834, 58.5609613065%, 79.4167045226%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(73.2409346734, 58.2014437186%, 78.670818593%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(77.5346984925, 57.7883633166%, 77.8924165829%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(81.8284623116, 57.3752829146%, 77.1140145729%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(86.1222261307, 56.9622025126%, 76.3356125628%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(90.4159899497, 56.5491221106%, 75.5572105528%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(94.7097537688, 56.1360417085%, 74.7788085427%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(99.0035175879, 55.7229613065%, 74.0004065327%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(103.297281407, 55.3098809045%, 73.2220045226%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(107.591045226, 54.8968005025%, 72.4436025126%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(111.884809045, 54.4837201005%, 71.6652005025%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(116.178572864, 54.0706396985%, 70.8867984925%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(120.472336683, 53.6575592965%, 70.1083964824%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(124.766100503, 53.2444788945%, 69.3299944724%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(129.059864322, 52.8313984925%, 68.5515924623%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(133.353628141, 52.4183180905%, 67.7731904523%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(137.64739196, 52.0052376884%, 66.9947884422%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(141.941155779, 51.5921572864%, 66.2163864322%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(146.234919598, 51.1790768844%, 65.4379844221%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(150.528683417, 50.7659964824%, 64.6595824121%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(154.822447236, 50.3529160804%, 63.881180402%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(157.181135678, 50.0414758794%, 63.1264246231%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(159.056055276, 49.7554457286%, 62.377580402%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(160.930974874, 49.4694155779%, 61.6287361809%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(162.805894472, 49.1833854271%, 60.8798919598%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(164.68081407, 48.8973552764%, 60.1310477387%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(166.555733668, 48.6113251256%, 59.3822035176%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(168.430653266, 48.3252949749%, 58.6333592965%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(170.305572864, 48.0392648241%, 57.8845150754%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(172.180492462, 47.7532346734%, 57.1356708543%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(174.05541206, 47.4672045226%, 56.3868266332%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(175.930331658, 47.1811743719%, 55.6379824121%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(177.805251256, 46.8951442211%, 54.889138191%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(179.680170854, 46.6091140704%, 54.1402939698%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(181.555090452, 46.3230839196%, 53.3914497487%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(183.43001005, 46.0370537688%, 52.6426055276%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(185.304929648, 45.7510236181%, 51.8937613065%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(187.179849246, 45.4649934673%, 51.1449170854%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(189.054768844, 45.1789633166%, 50.3960728643%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(190.929688442, 44.8929331658%, 49.6472286432%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(192.80460804, 44.6069030151%, 48.8983844221%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(194.174188945, 44.8463462312%, 48.3712386935%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(195.487621106, 45.1441753769%, 47.8687261307%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(196.801053266, 45.4420045226%, 47.3662135678%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(198.114485427, 45.7398336683%, 46.863701005%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(199.427917588, 46.0376628141%, 46.3611884422%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(200.741349749, 46.3354919598%, 45.8586758794%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(202.05478191, 46.6333211055%, 45.3561633166%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(203.36821407, 46.9311502513%, 44.8536507538%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(204.681646231, 47.228979397%, 44.351138191%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(205.995078392, 47.5268085427%, 43.8486256281%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(207.308510553, 47.8246376884%, 43.3461130653%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(208.621942714, 48.1224668342%, 42.8436005025%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(209.935374874, 48.4202959799%, 42.3410879397%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(211.248807035, 48.7181251256%, 41.8385753769%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(212.562239196, 49.0159542714%, 41.3360628141%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(213.875671357, 49.3137834171%, 40.8335502513%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(215.189103518, 49.6116125628%, 40.3310376884%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(216.502535678, 49.9094417085%, 39.8285251256%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(217.815967839, 50.2072708543%, 39.3260125628%);height:20px;width:20px;display:inline-block;\"></div><div style=\"background-color:hsl(219.1294, 50.5051%, 38.8235%);height:20px;width:20px;display:inline-block;\"></div>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 33, | |
"text": [ | |
"<IPython.core.display.HTML at 0x1074db0d0>" | |
] | |
} | |
], | |
"prompt_number": 33 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"class shifter:\n", | |
" def __init__(self):\n", | |
" self.x = np.cos(4*z)*( np.power(z+1,3) )\n", | |
" self.y = np.sin(4*z)*( np.power(z+1,3) )\n", | |
" self.colors = cl.interp( cl.scales['11']['div']['RdYlBu'], z)\n", | |
" \n", | |
" def on_phase_change(self, name, old_value, new_value):\n", | |
" self.x = np.cos(4*z+new_value)*( np.power(z+1,3) )\n", | |
" self.y = np.sin(4*z+new_value)*( np.power(z+1,3) )\n", | |
" self.replot()\n", | |
" \n", | |
" def replot(self):\n", | |
" g.restyle({ 'x': [self.x], 'y': [self.y] })\n", | |
"\n", | |
"p_slider = widgets.FloatSliderWidget(min=0,max=10,value=1,step=0.05)\n", | |
"p_slider.description = 'Phase shift'\n", | |
"p_slider.value = 1\n", | |
"\n", | |
"p_state = shifter()\n", | |
"p_slider.on_trait_change(p_state.on_phase_change, 'value')" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 42 | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 2, | |
"metadata": {}, | |
"source": [ | |
"Create an empty graph - load only once in the beginning" | |
] | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 5, | |
"metadata": {}, | |
"source": [ | |
"(This graph won't load in nbviewer because it uses widgets, you have to download the notebook)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"g.restyle( { 'x':[x],\n", | |
" 'y':[y],\n", | |
" 'z':[z], \n", | |
" 'marker':{'size':np.power(z,1.2),'opacity':0.9,'color':colors}, \n", | |
" 'type':'scatter3d' } )" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 46 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"g = GraphWidget()\n", | |
"display(p_slider)\n", | |
"display(g)" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 45 | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 2, | |
"metadata": {}, | |
"source": [ | |
"Reference" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"help(Scatter3d)" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"Help on class Scatter3d in module plotly.graph_objs.graph_objs:\n", | |
"\n", | |
"class Scatter3d(PlotlyTrace)\n", | |
" | A dictionary-like object for representing a 3D scatter trace in plotly.\n", | |
" | \n", | |
" | Quick method reference:\n", | |
" | \n", | |
" | Scatter3d.update(changes)\n", | |
" | Scatter3d.strip_style()\n", | |
" | Scatter3d.get_data()\n", | |
" | Scatter3d.to_graph_objs()\n", | |
" | Scatter3d.validate()\n", | |
" | Scatter3d.to_string()\n", | |
" | Scatter3d.force_clean()\n", | |
" | \n", | |
" | Valid keys:\n", | |
" | \n", | |
" | x [required=True] (value=list or 1d numpy array of numbers, strings,\n", | |
" | datetimes or list of lists or 2d numpy array of numbers) (streamable):\n", | |
" | Sets the x coordinates of the points of this 3D scatter trace. If\n", | |
" | 'x' is linked to a list or 1d numpy array of strings, then the x\n", | |
" | coordinates are integers, 0, 1, 2, 3, ..., labeled on the x-axis by\n", | |
" | the list or 1d numpy array of strings linked to 'x'.\n", | |
" | \n", | |
" | y [required=True] (value=list or 1d numpy array of numbers, strings,\n", | |
" | datetimes or list of lists or 2d numpy array of numbers) (streamable):\n", | |
" | Sets the y coordinates of the points of this 3D scatter trace. If\n", | |
" | 'y' is linked to a list or 1d numpy array of strings, then the y\n", | |
" | coordinates are integers, 0, 1, 2, 3, ..., labeled on the y-axis by\n", | |
" | the list or 1d numpy array of strings linked to 'y'.\n", | |
" | \n", | |
" | z [required=True] (value=list or 1d numpy array of numbers, strings,\n", | |
" | datetimes or list of lists or 2d numpy array of numbers) (streamable):\n", | |
" | Sets the z coordinates of the points of this scatter trace. If 'z'\n", | |
" | is linked to a list or 1d numpy array of strings, then the z\n", | |
" | coordinates are integers, 0, 1, 2, 3, ..., labeled on the z-axis by\n", | |
" | the list or 1d numpy array of strings linked to 'z'.\n", | |
" | \n", | |
" | mode [required=False] (value='lines' | 'markers' | 'text' |\n", | |
" | 'lines+markers' | 'lines+text' | 'markers+text' | 'lines+markers+text'):\n", | |
" | Plotting mode for this 3D scatter trace. If the mode includes 'text'\n", | |
" | then the 'text' will appear at the (x,y) points, otherwise it will\n", | |
" | appear on hover.\n", | |
" | \n", | |
" | name [required=False] (value=a string):\n", | |
" | The label associated with this trace. This name will appear in the\n", | |
" | column header in the online spreadsheet.\n", | |
" | \n", | |
" | text [required=False] (value=list or 1d numpy array of strings)\n", | |
" | (streamable):\n", | |
" | The text elements associated with each (x,y,z) pair in this 3D\n", | |
" | scatter trace. If the scatter 'mode' does not include 'text' then\n", | |
" | elements linked to 'text' will appear on hover only. In contrast, if\n", | |
" | 'text' is included in 'mode', the elements in 'text' will be\n", | |
" | rendered on the plot at the locations specified in part by their\n", | |
" | corresponding (x,y,z) coordinate pair and the 'textposition' key.\n", | |
" | \n", | |
" | error_z [required=False] (value=ErrorZ object | dictionary-like object)\n", | |
" | (streamable):\n", | |
" | Links a dictionary-like object describing the z-axis error bars that\n", | |
" | can be drawn from the (x,y,z) coordinates of this 3D scatter trace.\n", | |
" | \n", | |
" | For more, run `help(plotly.graph_objs.ErrorZ)`\n", | |
" | \n", | |
" | error_y [required=False] (value=ErrorY object | dictionary-like object)\n", | |
" | (streamable):\n", | |
" | Links a dictionary-like object describing the y-axis error bars that\n", | |
" | can be drawn from the (x,y,z) coordinates of this 3D scatter trace.\n", | |
" | \n", | |
" | For more, run `help(plotly.graph_objs.ErrorY)`\n", | |
" | \n", | |
" | error_x [required=False] (value=ErrorX object | dictionary-like object)\n", | |
" | (streamable):\n", | |
" | Links a dictionary-like object describing the x-axis error bars that\n", | |
" | can be drawn from the (x,y,z) coordinates of this 3D scatter trace.\n", | |
" | \n", | |
" | For more, run `help(plotly.graph_objs.ErrorX)`\n", | |
" | \n", | |
" | marker [required=False] (value=Marker object | dictionary-like object)\n", | |
" | (streamable):\n", | |
" | Links a dictionary-like object containing marker style parameters\n", | |
" | for this 3D scatter trace. Has an effect only if 'mode' contains\n", | |
" | 'markers'.\n", | |
" | \n", | |
" | For more, run `help(plotly.graph_objs.Marker)`\n", | |
" | \n", | |
" | line [required=False] (value=Line object | dictionary-like object)\n", | |
" | (streamable):\n", | |
" | Links a dictionary-like object containing line parameters for this\n", | |
" | 3D scatter trace. Has an effect only if 'mode' contains 'lines'.\n", | |
" | \n", | |
" | For more, run `help(plotly.graph_objs.Line)`\n", | |
" | \n", | |
" | textposition [required=False] (value='top left' | 'top' (or 'top\n", | |
" | center')| 'top right' | 'left' (or 'middle left') | '' (or 'middle\n", | |
" | center') | 'right' (or 'middle right') | 'bottom left' | 'bottom' (or\n", | |
" | 'bottom center') | 'bottom right'):\n", | |
" | Sets the position of the text elements in the 'text' key with\n", | |
" | respect to the data points. By default, the text elements are\n", | |
" | plotted directly at the (x,y,z) coordinates.\n", | |
" | \n", | |
" | scene [required=False] (value='scene1' | 'scene2' | 'scene3' | etc.):\n", | |
" | This key determines the scene on which this trace will be plotted\n", | |
" | in.\n", | |
" | \n", | |
" | stream [required=False] (value=Stream object | dictionary-like object):\n", | |
" | Links a dictionary-like object that initializes this trace as a\n", | |
" | writable-stream, for use with the streaming API.\n", | |
" | \n", | |
" | For more, run `help(plotly.graph_objs.Stream)`\n", | |
" | \n", | |
" | visible [required=False] (value=a boolean: True | False):\n", | |
" | Toggles whether or not this object will be visible on the rendered\n", | |
" | figure.\n", | |
" | \n", | |
" | type [required=False] (value='scatter3d'):\n", | |
" | Plotly identifier for this data's trace type.\n", | |
" | \n", | |
" | Method resolution order:\n", | |
" | Scatter3d\n", | |
" | PlotlyTrace\n", | |
" | PlotlyDict\n", | |
" | __builtin__.dict\n", | |
" | __builtin__.object\n", | |
" | \n", | |
" | Methods inherited from PlotlyTrace:\n", | |
" | \n", | |
" | __init__(self, *args, **kwargs)\n", | |
" | \n", | |
" | to_string(self, level=0, indent=4, eol='\\n', pretty=True, max_chars=80)\n", | |
" | Returns a formatted string showing graph_obj constructors.\n", | |
" | \n", | |
" | Example:\n", | |
" | \n", | |
" | print(obj.to_string())\n", | |
" | \n", | |
" | Keyword arguments:\n", | |
" | level (default = 0) -- set number of indentations to start with\n", | |
" | indent (default = 4) -- set indentation amount\n", | |
" | eol (default = '\\n') -- set end of line character(s)\n", | |
" | pretty (default = True) -- curtail long list output with a '...'\n", | |
" | max_chars (default = 80) -- set max characters per line\n", | |
" | \n", | |
" | ----------------------------------------------------------------------\n", | |
" | Methods inherited from PlotlyDict:\n", | |
" | \n", | |
" | __setitem__(self, key, value)\n", | |
" | \n", | |
" | force_clean(self, caller=True)\n", | |
" | Attempts to convert to graph_objs and call force_clean() on values.\n", | |
" | \n", | |
" | Calling force_clean() on a PlotlyDict will ensure that the object is\n", | |
" | valid and may be sent to plotly. This process will also remove any\n", | |
" | entries that end up with a length == 0.\n", | |
" | \n", | |
" | Careful! This will delete any invalid entries *silently*.\n", | |
" | \n", | |
" | get_data(self)\n", | |
" | Returns the JSON for the plot with non-data elements stripped.\n", | |
" | \n", | |
" | get_ordered(self, caller=True)\n", | |
" | \n", | |
" | strip_style(self)\n", | |
" | Strip style from the current representation.\n", | |
" | \n", | |
" | All PlotlyDicts and PlotlyLists are guaranteed to survive the\n", | |
" | stripping process, though they made be left empty. This is allowable.\n", | |
" | \n", | |
" | Keys that will be stripped in this process are tagged with\n", | |
" | `'type': 'style'` in graph_objs_meta.json.\n", | |
" | \n", | |
" | This process first attempts to convert nested collections from dicts\n", | |
" | or lists to subclasses of PlotlyList/PlotlyDict. This process forces\n", | |
" | a validation, which may throw exceptions.\n", | |
" | \n", | |
" | Then, each of these objects call `strip_style` on themselves and so\n", | |
" | on, recursively until the entire structure has been validated and\n", | |
" | stripped.\n", | |
" | \n", | |
" | to_graph_objs(self, caller=True)\n", | |
" | Walk obj, convert dicts and lists to plotly graph objs.\n", | |
" | \n", | |
" | For each key in the object, if it corresponds to a special key that\n", | |
" | should be associated with a graph object, the ordinary dict or list\n", | |
" | will be reinitialized as a special PlotlyDict or PlotlyList of the\n", | |
" | appropriate `kind`.\n", | |
" | \n", | |
" | update(self, dict1=None, **dict2)\n", | |
" | Update current dict with dict1 and then dict2.\n", | |
" | \n", | |
" | This recursively updates the structure of the original dictionary-like\n", | |
" | object with the new entries in the second and third objects. This\n", | |
" | allows users to update with large, nested structures.\n", | |
" | \n", | |
" | Note, because the dict2 packs up all the keyword arguments, you can\n", | |
" | specify the changes as a list of keyword agruments.\n", | |
" | \n", | |
" | Examples:\n", | |
" | # update with dict\n", | |
" | obj = Layout(title='my title', xaxis=XAxis(range=[0,1], domain=[0,1]))\n", | |
" | update_dict = dict(title='new title', xaxis=dict(domain=[0,.8]))\n", | |
" | obj.update(update_dict)\n", | |
" | obj\n", | |
" | {'title': 'new title', 'xaxis': {'range': [0,1], 'domain': [0,.8]}}\n", | |
" | \n", | |
" | # update with list of keyword arguments\n", | |
" | obj = Layout(title='my title', xaxis=XAxis(range=[0,1], domain=[0,1]))\n", | |
" | obj.update(title='new title', xaxis=dict(domain=[0,.8]))\n", | |
" | obj\n", | |
" | {'title': 'new title', 'xaxis': {'range': [0,1], 'domain': [0,.8]}}\n", | |
" | \n", | |
" | This 'fully' supports duck-typing in that the call signature is\n", | |
" | identical, however this differs slightly from the normal update\n", | |
" | method provided by Python's dictionaries.\n", | |
" | \n", | |
" | validate(self, caller=True)\n", | |
" | Recursively check the validity of the keys in a PlotlyDict.\n", | |
" | \n", | |
" | The valid keys constitute the entries in each object\n", | |
" | dictionary in graph_objs_meta.json\n", | |
" | \n", | |
" | The validation process first requires that all nested collections be\n", | |
" | converted to the appropriate subclass of PlotlyDict/PlotlyList. Then,\n", | |
" | each of these objects call `validate` and so on, recursively,\n", | |
" | until the entire object has been validated.\n", | |
" | \n", | |
" | ----------------------------------------------------------------------\n", | |
" | Data descriptors inherited from PlotlyDict:\n", | |
" | \n", | |
" | __dict__\n", | |
" | dictionary for instance variables (if defined)\n", | |
" | \n", | |
" | __weakref__\n", | |
" | list of weak references to the object (if defined)\n", | |
" | \n", | |
" | ----------------------------------------------------------------------\n", | |
" | Methods inherited from __builtin__.dict:\n", | |
" | \n", | |
" | __cmp__(...)\n", | |
" | x.__cmp__(y) <==> cmp(x,y)\n", | |
" | \n", | |
" | __contains__(...)\n", | |
" | D.__contains__(k) -> True if D has a key k, else False\n", | |
" | \n", | |
" | __delitem__(...)\n", | |
" | x.__delitem__(y) <==> del x[y]\n", | |
" | \n", | |
" | __eq__(...)\n", | |
" | x.__eq__(y) <==> x==y\n", | |
" | \n", | |
" | __ge__(...)\n", | |
" | x.__ge__(y) <==> x>=y\n", | |
" | \n", | |
" | __getattribute__(...)\n", | |
" | x.__getattribute__('name') <==> x.name\n", | |
" | \n", | |
" | __getitem__(...)\n", | |
" | x.__getitem__(y) <==> x[y]\n", | |
" | \n", | |
" | __gt__(...)\n", | |
" | x.__gt__(y) <==> x>y\n", | |
" | \n", | |
" | __iter__(...)\n", | |
" | x.__iter__() <==> iter(x)\n", | |
" | \n", | |
" | __le__(...)\n", | |
" | x.__le__(y) <==> x<=y\n", | |
" | \n", | |
" | __len__(...)\n", | |
" | x.__len__() <==> len(x)\n", | |
" | \n", | |
" | __lt__(...)\n", | |
" | x.__lt__(y) <==> x<y\n", | |
" | \n", | |
" | __ne__(...)\n", | |
" | x.__ne__(y) <==> x!=y\n", | |
" | \n", | |
" | __repr__(...)\n", | |
" | x.__repr__() <==> repr(x)\n", | |
" | \n", | |
" | __sizeof__(...)\n", | |
" | D.__sizeof__() -> size of D in memory, in bytes\n", | |
" | \n", | |
" | clear(...)\n", | |
" | D.clear() -> None. Remove all items from D.\n", | |
" | \n", | |
" | copy(...)\n", | |
" | D.copy() -> a shallow copy of D\n", | |
" | \n", | |
" | fromkeys(...)\n", | |
" | dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.\n", | |
" | v defaults to None.\n", | |
" | \n", | |
" | get(...)\n", | |
" | D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.\n", | |
" | \n", | |
" | has_key(...)\n", | |
" | D.has_key(k) -> True if D has a key k, else False\n", | |
" | \n", | |
" | items(...)\n", | |
" | D.items() -> list of D's (key, value) pairs, as 2-tuples\n", | |
" | \n", | |
" | iteritems(...)\n", | |
" | D.iteritems() -> an iterator over the (key, value) items of D\n", | |
" | \n", | |
" | iterkeys(...)\n", | |
" | D.iterkeys() -> an iterator over the keys of D\n", | |
" | \n", | |
" | itervalues(...)\n", | |
" | D.itervalues() -> an iterator over the values of D\n", | |
" | \n", | |
" | keys(...)\n", | |
" | D.keys() -> list of D's keys\n", | |
" | \n", | |
" | pop(...)\n", | |
" | D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\n", | |
" | If key is not found, d is returned if given, otherwise KeyError is raised\n", | |
" | \n", | |
" | popitem(...)\n", | |
" | D.popitem() -> (k, v), remove and return some (key, value) pair as a\n", | |
" | 2-tuple; but raise KeyError if D is empty.\n", | |
" | \n", | |
" | setdefault(...)\n", | |
" | D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D\n", | |
" | \n", | |
" | values(...)\n", | |
" | D.values() -> list of D's values\n", | |
" | \n", | |
" | viewitems(...)\n", | |
" | D.viewitems() -> a set-like object providing a view on D's items\n", | |
" | \n", | |
" | viewkeys(...)\n", | |
" | D.viewkeys() -> a set-like object providing a view on D's keys\n", | |
" | \n", | |
" | viewvalues(...)\n", | |
" | D.viewvalues() -> an object providing a view on D's values\n", | |
" | \n", | |
" | ----------------------------------------------------------------------\n", | |
" | Data and other attributes inherited from __builtin__.dict:\n", | |
" | \n", | |
" | __hash__ = None\n", | |
" | \n", | |
" | __new__ = <built-in method __new__ of type object>\n", | |
" | T.__new__(S, ...) -> a new object with type S, a subtype of T\n", | |
"\n" | |
] | |
} | |
], | |
"prompt_number": 9 | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 1, | |
"metadata": {}, | |
"source": [ | |
"Custom styling" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"from IPython.core.display import HTML\n", | |
"import urllib2\n", | |
"HTML(urllib2.urlopen('http://bit.ly/1Bf5Hft').read())" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<style>\n", | |
"\n", | |
"html {\n", | |
" font-size: 62.5% !important; }\n", | |
"body {\n", | |
" font-size: 1.5em !important; /* currently ems cause chrome bug misinterpreting rems on body element */\n", | |
" line-height: 1.6 !important;\n", | |
" font-weight: 400 !important;\n", | |
" font-family: \"Raleway\", \"HelveticaNeue\", \"Helvetica Neue\", Helvetica, Arial, sans-serif !important;\n", | |
" color: #222 !important; }\n", | |
"\n", | |
"div{ border-radius: 0px !important; }\n", | |
"div.CodeMirror-sizer{ background: rgb(244, 244, 248) !important; }\n", | |
"div.input_area{ background: rgb(244, 244, 248) !important; }\n", | |
"\n", | |
"div.out_prompt_overlay:hover{ background: rgb(244, 244, 248) !important; }\n", | |
"div.input_prompt:hover{ background: rgb(244, 244, 248) !important; }\n", | |
"\n", | |
"h1, h2, h3, h4, h5, h6 {\n", | |
" color: #333 !important;\n", | |
" margin-top: 0 !important;\n", | |
" margin-bottom: 2rem !important;\n", | |
" font-weight: 300 !important; }\n", | |
"h1 { font-size: 4.0rem !important; line-height: 1.2 !important; letter-spacing: -.1rem !important;}\n", | |
"h2 { font-size: 3.6rem !important; line-height: 1.25 !important; letter-spacing: -.1rem !important; }\n", | |
"h3 { font-size: 3.0rem !important; line-height: 1.3 !important; letter-spacing: -.1rem !important; }\n", | |
"h4 { font-size: 2.4rem !important; line-height: 1.35 !important; letter-spacing: -.08rem !important; }\n", | |
"h5 { font-size: 1.8rem !important; line-height: 1.5 !important; letter-spacing: -.05rem !important; }\n", | |
"h6 { font-size: 1.5rem !important; line-height: 1.6 !important; letter-spacing: 0 !important; }\n", | |
"\n", | |
"@media (min-width: 550px) {\n", | |
" h1 { font-size: 5.0rem !important; }\n", | |
" h2 { font-size: 4.2rem !important; }\n", | |
" h3 { font-size: 3.6rem !important; }\n", | |
" h4 { font-size: 3.0rem !important; }\n", | |
" h5 { font-size: 2.4rem !important; }\n", | |
" h6 { font-size: 1.5rem !important; }\n", | |
"}\n", | |
"\n", | |
"p {\n", | |
" margin-top: 0 !important; }\n", | |
" \n", | |
"a {\n", | |
" color: #1EAEDB !important; }\n", | |
"a:hover {\n", | |
" color: #0FA0CE !important; }\n", | |
" \n", | |
"code {\n", | |
" padding: .2rem .5rem !important;\n", | |
" margin: 0 .2rem !important;\n", | |
" font-size: 90% !important;\n", | |
" white-space: nowrap !important;\n", | |
" background: #F1F1F1 !important;\n", | |
" border: 1px solid #E1E1E1 !important;\n", | |
" border-radius: 4px !important; }\n", | |
"pre > code {\n", | |
" display: block !important;\n", | |
" padding: 1rem 1.5rem !important;\n", | |
" white-space: pre !important; }\n", | |
" \n", | |
"button{ border-radius: 0px !important; }\n", | |
".navbar-inner{ background-image: none !important; }\n", | |
"select, textarea{ border-radius: 0px !important; }\n", | |
"\n", | |
"</style>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 118, | |
"text": [ | |
"<IPython.core.display.HTML at 0x1076c5d90>" | |
] | |
} | |
], | |
"prompt_number": 118 | |
} | |
], | |
"metadata": {} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment