Plotly's APIs and web app let you collaboratively make and share plots online. We've just added polar charts to our graphing library. From Wikipedia:
"A radar chart is a graphical method of displaying multivariate data in the form of a two-dimensional chart of three or more quantitative variables represented on axes starting from the same point."
In this IPython Notebook, we'll be plotting with our Python, R, and MATLAB APIs. You can also use our web app to edit your plots (even if made with the API), make plots, analyze your data, and collaborate in the browser.
If you'd like to run Plotly, you can use our public keys (shown below) or sign-up. It's free, you own your data and control your privacy, and you don't need to install or download.
You can copy and paste this code right into a NB or console. Install by running $ pip install plotly
or if that doesn't work try $ sudo pip install plotly
. For more on installation and the Python API, check out our user guide. You'll want to import Plotly or update it if you've installed before, sign in, and then we can get started.
import plotly
plotly.__version__
'1.0.34'
import plotly.plotly as py
import plotly.tools as tls
py.sign_in("IPython.Demo", "1fw3zw2o13")
Now we'll make our first plot.
import plotly.plotly as py
from plotly.graph_objs import *
py.sign_in("IPython.Demo", "1fw3zw2o13")
trace1 = Scatter(
r=[6.804985785265978, 3.389596010612268, 5.3814721107464445, 8.059540219420184, 5.318229227868589, 2.9850999356273773, 1.9665870023752283, 6.769265408206589, 4.073401898721205, 6.50437182526841, 7.556369818996649, 4.047456094066775, 7.386662496070009, 5.413624736983931, 7.470716531163242, 7.982110216939738, 4.737814080093381, 4.206453042929911, 5.478604804594065, 4.824520280697772, 5.599600609899737, 6.8667952170824735, 3.0856713662561464, 7.771810943227382, 3.6877944350967193, 5.360356685192225, 5.140446739300986, 6.045445680928888, 6.833920940193708, 3.6207694625408364, 3.9894305834039687, 5.3118244995018, 4.608213480282062, 6.640584716151912, 3.055188854482986, 7.492564163752965, 5.4850781777896715, 3.8977949966209358, 5.976245114026165, 5.447061560910957, 5.37703411681004, 4.690805787731301, 4.711640491184845, 3.629919329394875, 5.957668076372498, 5.357121284391151, 3.849235282821748, 6.250507136319218, 7.122243357145468, 3.399404233835391, 3.5105566722713313, 4.100997603660974, 4.096382100199779, 6.233583074805102, 3.939488526772935, 3.9254450773976983, 6.118132501462698, 3.9404503462852323, 7.583015573261159, 3.513202145338516],
t=[-30.352944361883697, -25.611459854524096, -12.425227452676078, 13.96138051872652, -4.9509328406707445, -25.692274190905437, 12.46876416157031, -4.913764107032951, -10.967380287631935, 30.814194054910676, 2.4749594311442737, 17.97554375239156, 0.7711305933623585, 6.137488485631386, -14.451963574013497, 28.184534112915948, 12.538680065954864, -8.983230337131154, 5.231285164762417, -64.48900253584051, 11.357486681772649, 3.4540747915125176, 13.924346613092862, -25.364002046782343, -16.81800638602268, -10.260051030559755, -13.212134125591882, 2.5793388653025744, 8.717574965852519, -10.675498719239487, -2.926366012522306, 25.195880754767717, 40.59032932155964, -9.121433630189772, -24.297362381339184, -3.1769445056889345, 10.85049841917252, -31.33205974736701, 4.849567462214266, 15.048276954124187, 3.2951046992599635, -6.197091873129837, -8.77857413578066, 29.549174119407287, -5.1374487928814645, 23.02686048794348, -6.634816578371129, 2.7550149918614695, 21.733250113653973, -24.816994960101756, -7.83054706253201, 28.325796210205855, 12.300977467795988, -21.563157240034112, -19.335516283813288, 26.146443170846787, -1.7060712026841085, 16.071723694996702, 2.053266302846965, -5.097911612332572],
mode='markers',
name='Trial 1',
marker=Marker(
color='rgb(27,158,119)',
size=110,
line=Line(
color='white'
),
opacity=0.7
)
)
trace2 = Scatter(
r=[3.488043923008057, 2.9184785763552368, 4.201827359971069, 8.227324606851074, 4.776690427237194, 3.041912303114453, 4.789947719076336, 5.663880780360856, 3.858262393172743, 8.260212881141047, 6.868624486428106, 5.7401975996748895, 6.594979282458134, 5.692703778211614, 5.337916574462772, 9.283604185175781, 5.7645908931363365, 4.028864552051332, 5.662344748373121, 0.42283723110061455, 6.201266463929336, 6.43926538131984, 5.096758513060891, 4.632081908733815, 3.4218461363102217, 4.369404703352921, 4.02833441941273, 5.80576719754376, 6.848189921425055, 3.8092955127795802, 4.385268183833586, 6.98332684554596, 7.396273186029126, 5.215125003141, 3.0861487792429205, 6.335394491488218, 6.0904147140584834, 2.4480560069033306, 5.942784020305152, 6.373129885590045, 5.454205341176391, 4.393337616563476, 4.2059446799773, 6.155542287959513, 5.119087171162872, 6.869860830828341, 4.104599860575049, 5.954348125582761, 8.092332877153778, 2.9617697054526295, 3.974012187582175, 6.373384128907529, 5.415409143179902, 3.876890919980343, 3.261446947424557, 6.145808529699159, 5.502451987192818, 5.571553295311899, 6.853049261089887, 4.140355074942654],
t=[14.80662578088746, 79.00634037258273, 49.02206554130045, 49.69908313603149, 54.137491082859476, 86.41932102054662, 96.95239193571373, 41.463488263612184, 67.13769169339066, 68.06103943971128, 42.68193032273406, 76.39865660811795, 42.19479347220856, 59.57788897461255, 27.510866799296068, 60.7534448322685, 68.37083279914752, 65.74802814945305, 58.53300837209963, -176.7441064584909, 61.17401857996598, 47.4515085890397, 84.4266531857914, 12.479346550525074, 72.48080276184626, 50.578831757750606, 51.560228240214684, 52.43785618126272, 51.586827992137934, 73.87294477733714, 70.21705692787259, 70.71429915430754, 82.23439442637098, 38.93539044700985, 84.7093666701594, 38.16582843645038, 61.70405365378903, 70.19695629244305, 54.454292590141606, 64.33489496861428, 58.273893146586325, 60.49982239038519, 59.155232538950266, 83.86561846759426, 47.87340989732011, 69.28260156593979, 71.1899104286971, 51.04839646304676, 59.427582415206295, 78.59873696166098, 75.75586451521559, 79.97048372322382, 73.89378024632016, 31.733411131690488, 68.08475117701943, 80.41107997857199, 48.92425070886502, 76.65025575535202, 42.18286436288056, 76.03333589453311],
mode='markers',
name='Trial 2',
marker=Marker(
color='rgb(217,95,2)',
size=110,
line=Line(
color='white'
),
opacity=0.7
)
)
trace3 = Scatter(
r=[1.855870835032611, 5.2869620620428215, 3.886013391943573, 6.282863313001057, 4.4534148477405155, 5.688008050761193, 7.330864282608489, 3.825660594787748, 4.989604176963506, 7.8974314697670955, 4.6566931130229525, 6.667153696311044, 4.4310062871369515, 5.346113253377259, 2.4799456958789263, 8.113477348526397, 6.081311682312096, 4.968216896207305, 5.24445392063028, 5.422207884171506, 5.792774616023354, 4.787580592225452, 6.784318637182092, 1.10893690948093, 5.138911105244, 4.042929657287297, 4.022892029681135, 4.828428791305017, 5.417378374307972, 5.378635210668265, 5.421097175459842, 7.1205619788552434, 8.349308539903586, 3.4104855883231204, 5.6283784708757345, 3.9149369761396855, 5.7639402623551526, 4.764374106798512, 5.076236267895072, 6.165558183200791, 5.105576516279834, 4.761036376933375, 4.5962495409437905, 7.504188411346776, 4.107031417919988, 6.920422299379973, 5.349128949563397, 4.798065719385607, 7.023251532304466, 5.283680965457643, 5.569071152430292, 7.383794908447646, 6.269233210443127, 2.656529645009885, 4.843984338804117, 7.247992361555254, 4.372959394411489, 6.570981081360247, 4.602479243892371, 5.6700520508263965],
t=[151.29425518111282, 147.1880250282001, 125.2821571123002, 87.0672979717481, 119.62789835678657, 147.74082414730458, 139.56459814488954, 101.39149710201973, 134.5601842795838, 104.02444470480259, 89.39314294483763, 123.19403140008181, 91.47434051519816, 113.33237361373538, 96.1499255673322, 93.28073452263222, 118.21556522583221, 132.32293737819631, 112.9411863909871, -179.74623313781393, 110.3035135586484, 97.7508361660772, 131.60808925703367, 115.49691923085226, 140.58118216037175, 123.39666211932598, 128.34200904453573, 107.6088103983526, 97.90468978746796, 137.12844797536522, 130.43124491245027, 112.2270844807976, 118.63020224581525, 106.05822558950737, 146.90810970600344, 90.27734955816595, 111.50528236323856, 151.0897425364386, 107.7213941567982, 111.30085499702685, 114.68027793629503, 126.56937949315531, 128.2189522328928, 125.35485719537647, 112.4180682532985, 111.79735567917727, 133.41805225814235, 105.18411684151033, 97.23103612064705, 146.66803680360073, 136.23931520140337, 121.79184419346764, 123.91132797113666, 129.86224497019268, 141.34395084996186, 123.27096774880371, 108.45882172345216, 124.41237705630053, 89.02711073868319, 134.8767011451154],
mode='markers',
name='Trial 3',
marker=Marker(
color='rgb(117,112,179)',
size=110,
line=Line(
color='white'
),
opacity=0.7
)
)
trace4 = Scatter(
r=[5.3724709243191295, 7.096355572040467, 4.883823903200083, 2.9201354412366496, 4.723963045684014, 7.423693950928521, 8.090946075397593, 3.3068445913715996, 6.050828482522597, 5.530232074438094, 2.47230695264053, 6.275670536862141, 2.6158961737877817, 4.653539944582694, 3.3354400138758, 4.795883604868761, 5.472711346482787, 5.881930490947868, 4.5715870720453795, 9.039861169796675, 4.6429075998956915, 3.1727677357988284, 7.044248138818528, 4.466336514107385, 6.557330289803022, 4.8208494372533615, 5.131915515212963, 3.9700122370488873, 3.4063238128284303, 6.476722963998372, 6.019218509330762, 5.664501534954291, 7.1587585225456705, 3.6007126616736462, 7.324127168758531, 2.552946156245396, 4.727133860387479, 6.971755207182515, 4.076578361066991, 4.946223407006624, 4.642155449043171, 5.3605748644110855, 5.391719067363011, 7.072524305096543, 4.101111570277392, 5.485732621016895, 6.192535286114146, 3.7687113918423396, 4.290311389760529, 7.060195369692179, 6.539691844176445, 6.679744406490943, 6.060825358695814, 4.786574040927106, 6.416686529666599, 6.70328133338789, 3.8888478104797555, 6.308591081194454, 2.4370447709043273, 6.508186347897975],
t=[-140.20332764140605, -168.084245433406, -166.2851413292181, 138.24886675310003, -174.4243864364084, -169.96048275947723, 176.9918226866201, -169.90141624864253, -172.64158159443713, 142.9516688139347, 172.4157463673128, 168.5193591959272, 177.82205369393654, 172.85519034865231, -146.01452170111628, 128.1772930242011, 169.16707278067625, -173.58857378893256, 173.72699270456877, -151.20610477226074, 166.26047716274937, 172.50756608236046, 173.9491839042747, -131.80684093766672, -170.63527383147678, -168.57708548315375, -166.76550342128579, 176.07048734819648, 162.29750149829133, -174.05574631254976, -178.06092985664986, 156.47126885027095, 155.23914214477145, -163.00052639405448, -170.116713265192, -170.63927248749107, 167.38314369359566, -163.0988170562564, 172.8807370063752, 163.38600768186703, 176.1825419773446, -174.579680173718, -172.33584488196067, 165.33802569398378, -172.52566426066147, 157.54287773943665, -175.88151109326037, 175.42764399370765, 142.06967472256432, -168.3407340189972, -175.8058311226083, 163.06374541935153, 171.72097499708474, -151.40390456860604, -168.2713690903466, 165.04532787828478, -177.3153366647533, 170.04241289697416, 173.59919660957283, -177.25065674571294],
mode='markers',
name='Trial 4',
marker=Marker(
color='rgb(231,41,138)',
size=110,
line=Line(
color='white'
),
opacity=0.7
)
)
trace5 = Scatter(
r=[7.937557871379145, 7.302746491515634, 5.929302221442996, 2.407178713166243, 5.27092188705965, 7.400596127535688, 6.810820338360006, 4.967759034422344, 6.190229370454795, 2.158518657950606, 4.00412589386977, 4.776617321633007, 4.232250451808441, 4.30765487269422, 6.200275172864116, 0.7275138485344722, 4.378006803811767, 6.004964939443091, 4.341931702915758, 10.237982935327496, 3.8021588886978415, 3.96928117013756, 5.7589801424664335, 7.674179069144705, 6.699953533011802, 5.7343103881346, 6.044275915297742, 4.3129430660866035, 3.3775452824133043, 6.367666727269062, 5.737244181549697, 3.3963514719893415, 4.216467481387725, 5.464885016717265, 7.311135577533859, 4.745400769362272, 3.9164685318876504, 7.6029729903258385, 4.125204829441439, 3.6767949496501635, 4.551235788519779, 5.606960531523096, 5.794844257485189, 5.030528155694793, 5.109586240991219, 3.4054402079637396, 6.02630612538526, 4.2211092636354195, 1.9097829365788486, 7.254669393921678, 6.268875872033599, 4.56258056659493, 4.9180579654382806, 6.83656096252698, 6.78648654914422, 4.751014334485786, 4.719926347642004, 4.9278052151809675, 4.059190587394083, 6.128338984290388],
t=[-101.83378577584543, -127.47839157875458, -112.2442849973417, -82.32591087119675, -114.6888556206928, -130.53786336160334, -145.0102649759552, -98.7488450072409, -124.44174882126121, -152.45411926998403, -89.29423655225057, -139.83245171792495, -91.54359518437012, -119.44216300369413, -92.45583852737828, -129.6599243163198, -131.0512350992248, -123.85291745359059, -118.08673900439605, -121.97921713765797, -121.91502996793754, -99.36184757774758, -141.46770199726927, -93.5662631891479, -126.33690140499776, -112.8349441777883, -114.38647992914663, -109.79607232724634, -102.74326471243563, -128.2467289067651, -127.79209264323043, -142.47362974536523, -161.58729418706835, -99.94061077957295, -130.16311732570668, -90.22881200957039, -122.65049121443685, -123.26775057177692, -111.99730880084306, -127.52831680551732, -117.93129533779559, -120.39163424547179, -119.38687147866949, -149.6746954924951, -107.85051750555007, -138.98993134073962, -127.5954702142739, -107.32083544041386, -117.5738074233824, -127.48166096847307, -129.91203316621693, -148.49521167061027, -135.33164137019145, -104.42165927641673, -123.87544021115426, -146.81682661802307, -107.0584854241401, -138.9025648732907, -88.89688251951031, -130.75446735589105],
mode='markers',
name='Trial 5',
marker=Marker(
color='rgb(102,166,30)',
size=110,
line=Line(
color='white'
),
opacity=0.7
)
)
trace6 = Scatter(
r=[8.46918052789063, 5.821997567373959, 6.1409183282181425, 5.831724284786043, 5.546754471857236, 5.62748770920125, 3.94832897601986, 6.490184614609525, 5.320618245151644, 3.2435930414929843, 6.444085331576761, 3.363778100648707, 6.463116810505407, 4.730944925781221, 7.796578411114142, 4.570127829915901, 3.926206816002813, 5.254348139870139, 4.8384111066133375, 8.694523998982934, 4.39953181821818, 5.8564839051788535, 3.62157703921442, 8.894912373110186, 5.494542836078211, 5.968980890853802, 6.047899573604184, 5.384671396722035, 5.381220018196653, 5.11157462273727, 4.7705611050578, 3.0983308826347407, 1.665083171936659, 6.740258533332946, 5.5944949288820025, 6.879630825669177, 4.382792466280775, 6.410843616485085, 5.154204317772818, 4.01515851865648, 4.9391488682598155, 5.298297314485713, 5.490417176946796, 2.6237512593812404, 5.9535886616652665, 3.3014793719195046, 4.954889001100974, 5.500053669614178, 4.4505123495497285, 5.786624513349857, 4.906834424064605, 2.6299694734469274, 3.769703608047238, 7.396735715500286, 5.7644819019579545, 2.794585195883112, 5.782033269824353, 3.4853519176219963, 6.500653598620165, 4.748640710129176],
t=[-66.53583632728323, -84.514422676922, -63.339741699567846, -24.146812744223833, -59.70124532256676, -88.06537267996578, -98.44420453532204, -49.15839681719936, -73.63622331202959, -17.923874678608904, -38.41239945460549, -66.34036237792131, -40.88883873919996, -52.46063321002169, -52.61046255912479, -7.039351050913894, -57.23545869215697, -71.64220350197985, -52.345396169095466, -92.78303867354904, -47.18716305503351, -41.969208462875166, -82.14422824993427, -59.43916560317718, -79.19482259319774, -62.29990853531319, -65.53790403937941, -48.9060554475786, -37.74831103800929, -78.05333345828834, -71.87311766307504, -41.891092825900685, -53.11545548549721, -52.997628097314845, -87.0843610179252, -43.61190483837573, -48.79799840560851, -82.56680315713163, -47.90996299570176, -46.57048558531105, -54.5004832176089, -65.90072712679752, -66.87331746360131, -75.48080725209734, -54.777693866880114, -42.5983345913628, -74.50816626907293, -47.11021844342552, -22.356873183328428, -84.19298674498425, -78.50528475620209, -65.0363717923471, -66.51373368133282, -63.52677656175937, -77.80907855131592, -68.51017974013602, -51.296869310885135, -68.33991302765452, -38.631733068443026, -77.85184858511114],
mode='markers',
name='Trial 6',
marker=Marker(
color='rgb(230,171,2)',
size=110,
line=Line(
color='white'
),
opacity=0.7
)
)
data = Data([trace1, trace2, trace3, trace4, trace5, trace6])
layout = Layout(
title='Hobbs-Pearson Trials',
font=Font(
size=15
),
plot_bgcolor='rgb(223, 223, 223)',
angularaxis=AngularAxis(
tickcolor='rgb(253,253,253)'
)
)
fig = Figure(data=data, layout=layout)
plot_url = py.iplot(fig, filename='polar-scatter')
In "The Secret History" the author mentions the Iliad's notion of "light shining from a dead star." Graphs are like that: a brief flash of light and brilliance from a dead dataset. Why is it dead? Because we'll never see or access the data used in plots. The data is buried in an email, desktop folder, or file. It's painful when we can't access data or code from a plot, whether it's one we just made, one we saw on Reddit or in a newspaper, or data from a long-ago published work.
Plotly solves that problem by saving graphs with their related data and JSON structure. You can call the data or figures from your terminal or download a csv from the web app. Append the relevant ending to a URL of any graph--regardless of how it was made--to see it in another language. For example we just made a plot at plot.ly/~IPython.Demo/4022; plot.ly/~IPython.Demo/4022.py gives you the Python script. Check out:
That's how to get the script. How does it work to get data or the figure in your terminal? Let's get started.
from plotly.graph_objs import Data, Layout, Figure
If we need help as we're exploring, you can invoke help, for example:
help(Data)
Help on class Data in module plotly.graph_objs.graph_objs: class Data(PlotlyList) | A list of traces to be shown on a plot/graph. | | Any operation that can be done with a standard list may be used with Data. | Instantiation requires an iterable (just like list does), for example: | | Data([Scatter(), Heatmap(), Box()]) | | Valid entry types: (dict or any subclass of Trace, i.e., Scatter, Box, etc.) | | | Quick method reference: | | Data.update(changes) | Data.strip_style() | Data.get_data() | Data.to_graph_objs() | Data.validate() | Data.to_string() | Data.force_clean() | | Method resolution order: | Data | PlotlyList | __builtin__.list | __builtin__.object | | Methods defined here: | | to_graph_objs(self, caller=True) | Change any nested collections to subclasses of PlotlyDict/List. | | Procedure: | 1. Attempt to convert all entries to a subclass of PlotlyTrace. | 2. Call `to_graph_objects` on each of these entries. | | ---------------------------------------------------------------------- | Methods inherited from PlotlyList: | | __init__(self, *args) | | force_clean(self, caller=True) | Attempts to convert to graph_objs and calls force_clean() on entries. | | Calling force_clean() on a PlotlyList will ensure that the object is | valid and may be sent to plotly. This process will remove any entries | that end up with a length == 0. It will also remove itself from | enclosing trivial structures if it is enclosed by a collection with | length 1, meaning the data is the ONLY object in the collection. | | Careful! This will delete any invalid entries *silently*. | | get_data(self) | Returns the JSON for the plot with non-data elements stripped. | | get_ordered(self, caller=True) | | strip_style(self) | Strip style from the current representation. | | All PlotlyDicts and PlotlyLists are guaranteed to survive the | stripping process, though they made be left empty. This is allowable. | | Keys that will be stripped in this process are tagged with | `'type': 'style'` in the INFO dictionary listed in graph_objs_meta.py. | | This process first attempts to convert nested collections from dicts | or lists to subclasses of PlotlyList/PlotlyDict. This process forces | a validation, which may throw exceptions. | | Then, each of these objects call `strip_style` on themselves and so | on, recursively until the entire structure has been validated and | stripped. | | to_string(self, level=0, indent=4, eol='\n', pretty=True, max_chars=80) | Returns a formatted string showing graph_obj constructors. | | Example: | | print obj.to_string() | | Keyword arguments: | level (default = 0) -- set number of indentations to start with | indent (default = 4) -- set indentation amount | eol (default = ' | ') -- set end of line character(s) | pretty (default = True) -- curtail long list output with a '...' | max_chars (default = 80) -- set max characters per line | | update(self, changes) | Update current list with changed_list, which must be iterable. | The 'changes' should be a list of dictionaries, however, | it is permitted to be a single dict object. | | validate(self, caller=True) | Recursively check the validity of the entries in a PlotlyList. | | PlotlyList may only contain suclasses of PlotlyDict, or dictionary-like | objects that can be re-instantiated as subclasses of PlotlyDict. | | The validation process first requires that all nested collections be | converted to the appropriate subclass of PlotlyDict/PlotlyList. Then, | each of these objects call `validate` and so on, recursively, | until the entire list has been validated. | | ---------------------------------------------------------------------- | Data descriptors inherited from PlotlyList: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Data and other attributes inherited from PlotlyList: | | __metaclass__ = <class 'plotly.graph_objs.graph_objs.ListMeta'> | A meta class for PlotlyList class creation. | | The sole purpose of this meta class is to properly create the __doc__ | attribute so that running help(Obj), where Obj is a subclass of PlotlyList, | will return useful information for that object. | | ---------------------------------------------------------------------- | Methods inherited from __builtin__.list: | | __add__(...) | x.__add__(y) <==> x+y | | __contains__(...) | x.__contains__(y) <==> y in x | | __delitem__(...) | x.__delitem__(y) <==> del x[y] | | __delslice__(...) | x.__delslice__(i, j) <==> del x[i:j] | | Use of negative indices is not supported. | | __eq__(...) | x.__eq__(y) <==> x==y | | __ge__(...) | x.__ge__(y) <==> x>=y | | __getattribute__(...) | x.__getattribute__('name') <==> x.name | | __getitem__(...) | x.__getitem__(y) <==> x[y] | | __getslice__(...) | x.__getslice__(i, j) <==> x[i:j] | | Use of negative indices is not supported. | | __gt__(...) | x.__gt__(y) <==> x>y | | __iadd__(...) | x.__iadd__(y) <==> x+=y | | __imul__(...) | x.__imul__(y) <==> x*=y | | __iter__(...) | x.__iter__() <==> iter(x) | | __le__(...) | x.__le__(y) <==> x<=y | | __len__(...) | x.__len__() <==> len(x) | | __lt__(...) | x.__lt__(y) <==> x<y | | __mul__(...) | x.__mul__(n) <==> x*n | | __ne__(...) | x.__ne__(y) <==> x!=y | | __repr__(...) | x.__repr__() <==> repr(x) | | __reversed__(...) | L.__reversed__() -- return a reverse iterator over the list | | __rmul__(...) | x.__rmul__(n) <==> n*x | | __setitem__(...) | x.__setitem__(i, y) <==> x[i]=y | | __setslice__(...) | x.__setslice__(i, j, y) <==> x[i:j]=y | | Use of negative indices is not supported. | | __sizeof__(...) | L.__sizeof__() -- size of L in memory, in bytes | | append(...) | L.append(object) -- append object to end | | count(...) | L.count(value) -> integer -- return number of occurrences of value | | extend(...) | L.extend(iterable) -- extend list by appending elements from the iterable | | index(...) | L.index(value, [start, [stop]]) -> integer -- return first index of value. | Raises ValueError if the value is not present. | | insert(...) | L.insert(index, object) -- insert object before index | | pop(...) | L.pop([index]) -> item -- remove and return item at index (default last). | Raises IndexError if list is empty or index is out of range. | | remove(...) | L.remove(value) -- remove first occurrence of value. | Raises ValueError if the value is not present. | | reverse(...) | L.reverse() -- reverse *IN PLACE* | | sort(...) | L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*; | cmp(x, y) -> -1, 0, 1 | | ---------------------------------------------------------------------- | Data and other attributes inherited from __builtin__.list: | | __hash__ = None | | __new__ = <built-in method __new__ of type object> | T.__new__(S, ...) -> a new object with type S, a subtype of T
Now, you'll recall we named our figure above fig
. Let's call the data for it.
my_data = fig.get_data()
my_data
[{'name': 'Trial 1', 'r': [6.804985785265978, 3.389596010612268, 5.3814721107464445, 8.059540219420184, 5.318229227868589, 2.9850999356273773, 1.9665870023752283, 6.769265408206589, 4.073401898721205, 6.50437182526841, 7.556369818996649, 4.047456094066775, 7.386662496070009, 5.413624736983931, 7.470716531163242, 7.982110216939738, 4.737814080093381, 4.206453042929911, 5.478604804594065, 4.824520280697772, 5.599600609899737, 6.8667952170824735, 3.0856713662561464, 7.771810943227382, 3.6877944350967193, 5.360356685192225, 5.140446739300986, 6.045445680928888, 6.833920940193708, 3.6207694625408364, 3.9894305834039687, 5.3118244995018, 4.608213480282062, 6.640584716151912, 3.055188854482986, 7.492564163752965, 5.4850781777896715, 3.8977949966209358, 5.976245114026165, 5.447061560910957, 5.37703411681004, 4.690805787731301, 4.711640491184845, 3.629919329394875, 5.957668076372498, 5.357121284391151, 3.849235282821748, 6.250507136319218, 7.122243357145468, 3.399404233835391, 3.5105566722713313, 4.100997603660974, 4.096382100199779, 6.233583074805102, 3.939488526772935, 3.9254450773976983, 6.118132501462698, 3.9404503462852323, 7.583015573261159, 3.513202145338516], 't': [-30.352944361883697, -25.611459854524096, -12.425227452676078, 13.96138051872652, -4.9509328406707445, -25.692274190905437, 12.46876416157031, -4.913764107032951, -10.967380287631935, 30.814194054910676, 2.4749594311442737, 17.97554375239156, 0.7711305933623585, 6.137488485631386, -14.451963574013497, 28.184534112915948, 12.538680065954864, -8.983230337131154, 5.231285164762417, -64.48900253584051, 11.357486681772649, 3.4540747915125176, 13.924346613092862, -25.364002046782343, -16.81800638602268, -10.260051030559755, -13.212134125591882, 2.5793388653025744, 8.717574965852519, -10.675498719239487, -2.926366012522306, 25.195880754767717, 40.59032932155964, -9.121433630189772, -24.297362381339184, -3.1769445056889345, 10.85049841917252, -31.33205974736701, 4.849567462214266, 15.048276954124187, 3.2951046992599635, -6.197091873129837, -8.77857413578066, 29.549174119407287, -5.1374487928814645, 23.02686048794348, -6.634816578371129, 2.7550149918614695, 21.733250113653973, -24.816994960101756, -7.83054706253201, 28.325796210205855, 12.300977467795988, -21.563157240034112, -19.335516283813288, 26.146443170846787, -1.7060712026841085, 16.071723694996702, 2.053266302846965, -5.097911612332572]}, {'name': 'Trial 2', 'r': [3.488043923008057, 2.9184785763552368, 4.201827359971069, 8.227324606851074, 4.776690427237194, 3.041912303114453, 4.789947719076336, 5.663880780360856, 3.858262393172743, 8.260212881141047, 6.868624486428106, 5.7401975996748895, 6.594979282458134, 5.692703778211614, 5.337916574462772, 9.283604185175781, 5.7645908931363365, 4.028864552051332, 5.662344748373121, 0.42283723110061455, 6.201266463929336, 6.43926538131984, 5.096758513060891, 4.632081908733815, 3.4218461363102217, 4.369404703352921, 4.02833441941273, 5.80576719754376, 6.848189921425055, 3.8092955127795802, 4.385268183833586, 6.98332684554596, 7.396273186029126, 5.215125003141, 3.0861487792429205, 6.335394491488218, 6.0904147140584834, 2.4480560069033306, 5.942784020305152, 6.373129885590045, 5.454205341176391, 4.393337616563476, 4.2059446799773, 6.155542287959513, 5.119087171162872, 6.869860830828341, 4.104599860575049, 5.954348125582761, 8.092332877153778, 2.9617697054526295, 3.974012187582175, 6.373384128907529, 5.415409143179902, 3.876890919980343, 3.261446947424557, 6.145808529699159, 5.502451987192818, 5.571553295311899, 6.853049261089887, 4.140355074942654], 't': [14.80662578088746, 79.00634037258273, 49.02206554130045, 49.69908313603149, 54.137491082859476, 86.41932102054662, 96.95239193571373, 41.463488263612184, 67.13769169339066, 68.06103943971128, 42.68193032273406, 76.39865660811795, 42.19479347220856, 59.57788897461255, 27.510866799296068, 60.7534448322685, 68.37083279914752, 65.74802814945305, 58.53300837209963, -176.7441064584909, 61.17401857996598, 47.4515085890397, 84.4266531857914, 12.479346550525074, 72.48080276184626, 50.578831757750606, 51.560228240214684, 52.43785618126272, 51.586827992137934, 73.87294477733714, 70.21705692787259, 70.71429915430754, 82.23439442637098, 38.93539044700985, 84.7093666701594, 38.16582843645038, 61.70405365378903, 70.19695629244305, 54.454292590141606, 64.33489496861428, 58.273893146586325, 60.49982239038519, 59.155232538950266, 83.86561846759426, 47.87340989732011, 69.28260156593979, 71.1899104286971, 51.04839646304676, 59.427582415206295, 78.59873696166098, 75.75586451521559, 79.97048372322382, 73.89378024632016, 31.733411131690488, 68.08475117701943, 80.41107997857199, 48.92425070886502, 76.65025575535202, 42.18286436288056, 76.03333589453311]}, {'name': 'Trial 3', 'r': [1.855870835032611, 5.2869620620428215, 3.886013391943573, 6.282863313001057, 4.4534148477405155, 5.688008050761193, 7.330864282608489, 3.825660594787748, 4.989604176963506, 7.8974314697670955, 4.6566931130229525, 6.667153696311044, 4.4310062871369515, 5.346113253377259, 2.4799456958789263, 8.113477348526397, 6.081311682312096, 4.968216896207305, 5.24445392063028, 5.422207884171506, 5.792774616023354, 4.787580592225452, 6.784318637182092, 1.10893690948093, 5.138911105244, 4.042929657287297, 4.022892029681135, 4.828428791305017, 5.417378374307972, 5.378635210668265, 5.421097175459842, 7.1205619788552434, 8.349308539903586, 3.4104855883231204, 5.6283784708757345, 3.9149369761396855, 5.7639402623551526, 4.764374106798512, 5.076236267895072, 6.165558183200791, 5.105576516279834, 4.761036376933375, 4.5962495409437905, 7.504188411346776, 4.107031417919988, 6.920422299379973, 5.349128949563397, 4.798065719385607, 7.023251532304466, 5.283680965457643, 5.569071152430292, 7.383794908447646, 6.269233210443127, 2.656529645009885, 4.843984338804117, 7.247992361555254, 4.372959394411489, 6.570981081360247, 4.602479243892371, 5.6700520508263965], 't': [151.29425518111282, 147.1880250282001, 125.2821571123002, 87.0672979717481, 119.62789835678657, 147.74082414730458, 139.56459814488954, 101.39149710201973, 134.5601842795838, 104.02444470480259, 89.39314294483763, 123.19403140008181, 91.47434051519816, 113.33237361373538, 96.1499255673322, 93.28073452263222, 118.21556522583221, 132.32293737819631, 112.9411863909871, -179.74623313781393, 110.3035135586484, 97.7508361660772, 131.60808925703367, 115.49691923085226, 140.58118216037175, 123.39666211932598, 128.34200904453573, 107.6088103983526, 97.90468978746796, 137.12844797536522, 130.43124491245027, 112.2270844807976, 118.63020224581525, 106.05822558950737, 146.90810970600344, 90.27734955816595, 111.50528236323856, 151.0897425364386, 107.7213941567982, 111.30085499702685, 114.68027793629503, 126.56937949315531, 128.2189522328928, 125.35485719537647, 112.4180682532985, 111.79735567917727, 133.41805225814235, 105.18411684151033, 97.23103612064705, 146.66803680360073, 136.23931520140337, 121.79184419346764, 123.91132797113666, 129.86224497019268, 141.34395084996186, 123.27096774880371, 108.45882172345216, 124.41237705630053, 89.02711073868319, 134.8767011451154]}, {'name': 'Trial 4', 'r': [5.3724709243191295, 7.096355572040467, 4.883823903200083, 2.9201354412366496, 4.723963045684014, 7.423693950928521, 8.090946075397593, 3.3068445913715996, 6.050828482522597, 5.530232074438094, 2.47230695264053, 6.275670536862141, 2.6158961737877817, 4.653539944582694, 3.3354400138758, 4.795883604868761, 5.472711346482787, 5.881930490947868, 4.5715870720453795, 9.039861169796675, 4.6429075998956915, 3.1727677357988284, 7.044248138818528, 4.466336514107385, 6.557330289803022, 4.8208494372533615, 5.131915515212963, 3.9700122370488873, 3.4063238128284303, 6.476722963998372, 6.019218509330762, 5.664501534954291, 7.1587585225456705, 3.6007126616736462, 7.324127168758531, 2.552946156245396, 4.727133860387479, 6.971755207182515, 4.076578361066991, 4.946223407006624, 4.642155449043171, 5.3605748644110855, 5.391719067363011, 7.072524305096543, 4.101111570277392, 5.485732621016895, 6.192535286114146, 3.7687113918423396, 4.290311389760529, 7.060195369692179, 6.539691844176445, 6.679744406490943, 6.060825358695814, 4.786574040927106, 6.416686529666599, 6.70328133338789, 3.8888478104797555, 6.308591081194454, 2.4370447709043273, 6.508186347897975], 't': [-140.20332764140605, -168.084245433406, -166.2851413292181, 138.24886675310003, -174.4243864364084, -169.96048275947723, 176.9918226866201, -169.90141624864253, -172.64158159443713, 142.9516688139347, 172.4157463673128, 168.5193591959272, 177.82205369393654, 172.85519034865231, -146.01452170111628, 128.1772930242011, 169.16707278067625, -173.58857378893256, 173.72699270456877, -151.20610477226074, 166.26047716274937, 172.50756608236046, 173.9491839042747, -131.80684093766672, -170.63527383147678, -168.57708548315375, -166.76550342128579, 176.07048734819648, 162.29750149829133, -174.05574631254976, -178.06092985664986, 156.47126885027095, 155.23914214477145, -163.00052639405448, -170.116713265192, -170.63927248749107, 167.38314369359566, -163.0988170562564, 172.8807370063752, 163.38600768186703, 176.1825419773446, -174.579680173718, -172.33584488196067, 165.33802569398378, -172.52566426066147, 157.54287773943665, -175.88151109326037, 175.42764399370765, 142.06967472256432, -168.3407340189972, -175.8058311226083, 163.06374541935153, 171.72097499708474, -151.40390456860604, -168.2713690903466, 165.04532787828478, -177.3153366647533, 170.04241289697416, 173.59919660957283, -177.25065674571294]}, {'name': 'Trial 5', 'r': [7.937557871379145, 7.302746491515634, 5.929302221442996, 2.407178713166243, 5.27092188705965, 7.400596127535688, 6.810820338360006, 4.967759034422344, 6.190229370454795, 2.158518657950606, 4.00412589386977, 4.776617321633007, 4.232250451808441, 4.30765487269422, 6.200275172864116, 0.7275138485344722, 4.378006803811767, 6.004964939443091, 4.341931702915758, 10.237982935327496, 3.8021588886978415, 3.96928117013756, 5.7589801424664335, 7.674179069144705, 6.699953533011802, 5.7343103881346, 6.044275915297742, 4.3129430660866035, 3.3775452824133043, 6.367666727269062, 5.737244181549697, 3.3963514719893415, 4.216467481387725, 5.464885016717265, 7.311135577533859, 4.745400769362272, 3.9164685318876504, 7.6029729903258385, 4.125204829441439, 3.6767949496501635, 4.551235788519779, 5.606960531523096, 5.794844257485189, 5.030528155694793, 5.109586240991219, 3.4054402079637396, 6.02630612538526, 4.2211092636354195, 1.9097829365788486, 7.254669393921678, 6.268875872033599, 4.56258056659493, 4.9180579654382806, 6.83656096252698, 6.78648654914422, 4.751014334485786, 4.719926347642004, 4.9278052151809675, 4.059190587394083, 6.128338984290388], 't': [-101.83378577584543, -127.47839157875458, -112.2442849973417, -82.32591087119675, -114.6888556206928, -130.53786336160334, -145.0102649759552, -98.7488450072409, -124.44174882126121, -152.45411926998403, -89.29423655225057, -139.83245171792495, -91.54359518437012, -119.44216300369413, -92.45583852737828, -129.6599243163198, -131.0512350992248, -123.85291745359059, -118.08673900439605, -121.97921713765797, -121.91502996793754, -99.36184757774758, -141.46770199726927, -93.5662631891479, -126.33690140499776, -112.8349441777883, -114.38647992914663, -109.79607232724634, -102.74326471243563, -128.2467289067651, -127.79209264323043, -142.47362974536523, -161.58729418706835, -99.94061077957295, -130.16311732570668, -90.22881200957039, -122.65049121443685, -123.26775057177692, -111.99730880084306, -127.52831680551732, -117.93129533779559, -120.39163424547179, -119.38687147866949, -149.6746954924951, -107.85051750555007, -138.98993134073962, -127.5954702142739, -107.32083544041386, -117.5738074233824, -127.48166096847307, -129.91203316621693, -148.49521167061027, -135.33164137019145, -104.42165927641673, -123.87544021115426, -146.81682661802307, -107.0584854241401, -138.9025648732907, -88.89688251951031, -130.75446735589105]}, {'name': 'Trial 6', 'r': [8.46918052789063, 5.821997567373959, 6.1409183282181425, 5.831724284786043, 5.546754471857236, 5.62748770920125, 3.94832897601986, 6.490184614609525, 5.320618245151644, 3.2435930414929843, 6.444085331576761, 3.363778100648707, 6.463116810505407, 4.730944925781221, 7.796578411114142, 4.570127829915901, 3.926206816002813, 5.254348139870139, 4.8384111066133375, 8.694523998982934, 4.39953181821818, 5.8564839051788535, 3.62157703921442, 8.894912373110186, 5.494542836078211, 5.968980890853802, 6.047899573604184, 5.384671396722035, 5.381220018196653, 5.11157462273727, 4.7705611050578, 3.0983308826347407, 1.665083171936659, 6.740258533332946, 5.5944949288820025, 6.879630825669177, 4.382792466280775, 6.410843616485085, 5.154204317772818, 4.01515851865648, 4.9391488682598155, 5.298297314485713, 5.490417176946796, 2.6237512593812404, 5.9535886616652665, 3.3014793719195046, 4.954889001100974, 5.500053669614178, 4.4505123495497285, 5.786624513349857, 4.906834424064605, 2.6299694734469274, 3.769703608047238, 7.396735715500286, 5.7644819019579545, 2.794585195883112, 5.782033269824353, 3.4853519176219963, 6.500653598620165, 4.748640710129176], 't': [-66.53583632728323, -84.514422676922, -63.339741699567846, -24.146812744223833, -59.70124532256676, -88.06537267996578, -98.44420453532204, -49.15839681719936, -73.63622331202959, -17.923874678608904, -38.41239945460549, -66.34036237792131, -40.88883873919996, -52.46063321002169, -52.61046255912479, -7.039351050913894, -57.23545869215697, -71.64220350197985, -52.345396169095466, -92.78303867354904, -47.18716305503351, -41.969208462875166, -82.14422824993427, -59.43916560317718, -79.19482259319774, -62.29990853531319, -65.53790403937941, -48.9060554475786, -37.74831103800929, -78.05333345828834, -71.87311766307504, -41.891092825900685, -53.11545548549721, -52.997628097314845, -87.0843610179252, -43.61190483837573, -48.79799840560851, -82.56680315713163, -47.90996299570176, -46.57048558531105, -54.5004832176089, -65.90072712679752, -66.87331746360131, -75.48080725209734, -54.777693866880114, -42.5983345913628, -74.50816626907293, -47.11021844342552, -22.356873183328428, -84.19298674498425, -78.50528475620209, -65.0363717923471, -66.51373368133282, -63.52677656175937, -77.80907855131592, -68.51017974013602, -51.296869310885135, -68.33991302765452, -38.631733068443026, -77.85184858511114]}]
Now you could use Python to analyze and re-plot your data. Not bad. We can also check out the figure itself.
print fig.to_string()
Figure( data=Data([ Scatter( name='Trial 1', mode='markers', marker=Marker( line=Line( color='white' ), size=110, color='rgb(27,158,119)', opacity=0.7 ), r=[6.804985785265978, 3.389596010612268, 5.3814721107464445, 8....], t=[-30.352944361883697, -25.611459854524096, -12.42522745267607...] ), Scatter( name='Trial 2', mode='markers', marker=Marker( line=Line( color='white' ), size=110, color='rgb(217,95,2)', opacity=0.7 ), r=[3.488043923008057, 2.9184785763552368, 4.201827359971069, 8....], t=[14.80662578088746, 79.00634037258273, 49.02206554130045, 49....] ), Scatter( name='Trial 3', mode='markers', marker=Marker( line=Line( color='white' ), size=110, color='rgb(117,112,179)', opacity=0.7 ), r=[1.855870835032611, 5.2869620620428215, 3.886013391943573, 6....], t=[151.29425518111282, 147.1880250282001, 125.2821571123002, 87...] ), Scatter( name='Trial 4', mode='markers', marker=Marker( line=Line( color='white' ), size=110, color='rgb(231,41,138)', opacity=0.7 ), r=[5.3724709243191295, 7.096355572040467, 4.883823903200083, 2....], t=[-140.20332764140605, -168.084245433406, -166.2851413292181, ...] ), Scatter( name='Trial 5', mode='markers', marker=Marker( line=Line( color='white' ), size=110, color='rgb(102,166,30)', opacity=0.7 ), r=[7.937557871379145, 7.302746491515634, 5.929302221442996, 2.4...], t=[-101.83378577584543, -127.47839157875458, -112.2442849973417...] ), Scatter( name='Trial 6', mode='markers', marker=Marker( line=Line( color='white' ), size=110, color='rgb(230,171,2)', opacity=0.7 ), r=[8.46918052789063, 5.821997567373959, 6.1409183282181425, 5.8...], t=[-66.53583632728323, -84.514422676922, -63.339741699567846, -...] ) ]), layout=Layout( title='Hobbs-Pearson Trials', plot_bgcolor='rgb(223, 223, 223)', font=Font( size=15 ), angularaxis=AngularAxis( tickcolor='rgb(253,253,253)' ) ) )
We can also access the data within Plotly. You can fork and share e.g., https://plot.ly/~MattSundquist/1600 and edit or analyze the data to make new plots (polar and beyond). You can also extend that data from our APIs, copy and paste new data into your grid, or add data to pre-existing plots.
The goal is to be a neutral middle-ground for plotting and sharing between Python, matplotlib, R, ggplot2, MATLAB, Excel, Julia, node.js, Arduino, Raspberry Pi, and Tableau. To embed plots, you can use this iframe snippet and include your desired URL:
<iframe src="https://plot.ly/~MattSundquist/1334/650/550" width="650" height=550" frameBorder="0" seamless="seamless" scrolling="no"></iframe>
Iframes are like windows across the internet, letting one page open up a bit of space for another page to show through. You can embed any interactive Plotly graph in an iframe, thus letting you share a beautiful, interactive graph on your blog or website. That offers the experience you see below, in this case an embedded plot in this Tableau Workbook.
Next up, R. You can run all these plots in Python or MATLAB by getting them from our docs. Head over to our R API to see more and install the API.
library(plotly)
p <- plotly(username="IPython.Demo", key="1fw3zw2o13")
trace1 <- list(
r = c(1, 0.995, 0.978, 0.951, 0.914, 0.866, 0.809, 0.743, 0.669, 0.588, 0.5, 0.407, 0.309, 0.208, 0.105, 0, 0.105, 0.208, 0.309, 0.407, 0.5, 0.588, 0.669, 0.743, 0.809, 0.866, 0.914, 0.951, 0.978, 0.995, 1, 0.995, 0.978, 0.951, 0.914, 0.866, 0.809, 0.743, 0.669, 0.588, 0.5, 0.407, 0.309, 0.208, 0.105, 0, 0.105, 0.208, 0.309, 0.407, 0.5, 0.588, 0.669, 0.743, 0.809, 0.866, 0.914, 0.951, 0.978, 0.995, 1),
t = c(0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96, 102, 108, 114, 120, 126, 132, 138, 144, 150, 156, 162, 168, 174, 180, 186, 192, 198, 204, 210, 216, 222, 228, 234, 240, 246, 252, 258, 264, 270, 276, 282, 288, 294, 300, 306, 312, 318, 324, 330, 336, 342, 348, 354, 360),
mode = "lines",
name = "Figure8",
marker = list(
color = "none",
line = list(color = "peru")
),
type = "scatter"
)
trace2 <- list(
r = c(1, 0.997, 0.989, 0.976, 0.957, 0.933, 0.905, 0.872, 0.835, 0.794, 0.75, 0.703, 0.655, 0.604, 0.552, 0.5, 0.448, 0.396, 0.345, 0.297, 0.25, 0.206, 0.165, 0.128, 0.095, 0.067, 0.043, 0.024, 0.011, 0.003, 0, 0.003, 0.011, 0.024, 0.043, 0.067, 0.095, 0.128, 0.165, 0.206, 0.25, 0.297, 0.345, 0.396, 0.448, 0.5, 0.552, 0.604, 0.655, 0.703, 0.75, 0.794, 0.835, 0.872, 0.905, 0.933, 0.957, 0.976, 0.989, 0.997, 1),
t = c(0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96, 102, 108, 114, 120, 126, 132, 138, 144, 150, 156, 162, 168, 174, 180, 186, 192, 198, 204, 210, 216, 222, 228, 234, 240, 246, 252, 258, 264, 270, 276, 282, 288, 294, 300, 306, 312, 318, 324, 330, 336, 342, 348, 354, 360),
mode = "lines",
name = "Cardioid",
marker = list(
color = "none",
line = list(color = "darkviolet")
),
type = "scatter"
)
trace3 <- list(
r = c(1, 0.996, 0.984, 0.963, 0.935, 0.9, 0.857, 0.807, 0.752, 0.691, 0.625, 0.555, 0.482, 0.406, 0.328, 0.25, 0.172, 0.094, 0.018, 0.055, 0.125, 0.191, 0.252, 0.307, 0.357, 0.4, 0.435, 0.463, 0.484, 0.496, 0.5, 0.496, 0.484, 0.463, 0.435, 0.4, 0.357, 0.307, 0.252, 0.191, 0.125, 0.055, 0.018, 0.094, 0.172, 0.25, 0.328, 0.406, 0.482, 0.555, 0.625, 0.691, 0.752, 0.807, 0.857, 0.9, 0.935, 0.963, 0.984, 0.996, 1),
t = c(0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96, 102, 108, 114, 120, 126, 132, 138, 144, 150, 156, 162, 168, 174, 180, 186, 192, 198, 204, 210, 216, 222, 228, 234, 240, 246, 252, 258, 264, 270, 276, 282, 288, 294, 300, 306, 312, 318, 324, 330, 336, 342, 348, 354, 360),
mode = "lines",
name = "Hypercardioid",
marker = list(
color = "none",
line = list(color = "deepskyblue")
),
type = "scatter"
)
trace4 <- list(
r = c(1, 0.998, 0.993, 0.985, 0.974, 0.96, 0.943, 0.923, 0.901, 0.876, 0.85, 0.822, 0.793, 0.762, 0.731, 0.7, 0.669, 0.638, 0.607, 0.578, 0.55, 0.524, 0.499, 0.477, 0.457, 0.44, 0.426, 0.415, 0.407, 0.402, 0.4, 0.402, 0.407, 0.415, 0.426, 0.44, 0.457, 0.477, 0.499, 0.524, 0.55, 0.578, 0.607, 0.638, 0.669, 0.7, 0.731, 0.762, 0.793, 0.822, 0.85, 0.876, 0.901, 0.923, 0.943, 0.96, 0.974, 0.985, 0.993, 0.998, 1),
t = c(0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96, 102, 108, 114, 120, 126, 132, 138, 144, 150, 156, 162, 168, 174, 180, 186, 192, 198, 204, 210, 216, 222, 228, 234, 240, 246, 252, 258, 264, 270, 276, 282, 288, 294, 300, 306, 312, 318, 324, 330, 336, 342, 348, 354, 360),
mode = "lines",
name = "Subcardioid",
marker = list(
color = "none",
line = list(color = "orangered")
),
type = "scatter"
)
trace5 <- list(
r = c(1, 0.997, 0.986, 0.969, 0.946, 0.916, 0.88, 0.838, 0.792, 0.74, 0.685, 0.626, 0.565, 0.501, 0.436, 0.37, 0.304, 0.239, 0.175, 0.114, 0.055, 0, 0.052, 0.098, 0.14, 0.176, 0.206, 0.229, 0.246, 0.257, 0.26, 0.257, 0.246, 0.229, 0.206, 0.176, 0.14, 0.098, 0.052, 0, 0.055, 0.114, 0.175, 0.239, 0.304, 0.37, 0.436, 0.501, 0.565, 0.626, 0.685, 0.74, 0.792, 0.838, 0.88, 0.916, 0.946, 0.969, 0.986, 0.997, 1),
t = c(0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96, 102, 108, 114, 120, 126, 132, 138, 144, 150, 156, 162, 168, 174, 180, 186, 192, 198, 204, 210, 216, 222, 228, 234, 240, 246, 252, 258, 264, 270, 276, 282, 288, 294, 300, 306, 312, 318, 324, 330, 336, 342, 348, 354, 360),
mode = "lines",
name = "Supercardioid",
marker = list(
color = "none",
line = list(color = "green")
),
type = "scatter"
)
data <- list(trace1, trace2, trace3, trace4, trace5)
layout <- list(
title = "Mic Patterns",
font = list(
family = "Arial, sans-serif;",
size = 12,
color = "#000"
),
showlegend = TRUE,
width = 500,
height = 400,
margin = list(
l = 40,
r = 40,
b = 20,
t = 40,
pad = 0
),
paper_bgcolor = "rgb(255, 255, 255)",
plot_bgcolor = "rgb(255, 255, 255)",
orientation = -90
)
response <- p$plotly(data, kwargs=list(layout=layout, filename="polar-line", fileopt="overwrite"))
url <- response$url
filename <- response$filename
tls.embed('PlotBot','36')
If you'd like to access the data from the plot with a GUI, import data from Excel, and then re-plot the figure, you can. IPython also supports R, meaning you can call figures and data using the R kernel or RStudio. Like a boss.
And now, MATLAB. Head over to the API to install the API and run this plot.
signin('IPython.Demo', '1fw3zw2o13')
trace1 = struct(...
'r', [77.5, 72.5, 70.0, 45.0, 22.5, 42.5, 40.0, 62.5], ...
't', { {'North', 'N-E', 'East', 'S-E', 'South', 'S-W', 'West', 'N-W'} }, ...
'name', '11-14 m/s', ...
'marker', struct('color', 'rgb(106,81,163)'), ...
'type', 'area');
trace2 = struct(...
'r', [57.5, 50.0, 45.0, 35.0, 20.0, 22.5, 37.5, 55.0], ...
't', { {'North', 'N-E', 'East', 'S-E', 'South', 'S-W', 'West', 'N-W'} }, ...
'name', '8-11 m/s', ...
'marker', struct('color', 'rgb(158,154,200)'), ...
'type', 'area');
trace3 = struct(...
'r', [40.0, 30.0, 30.0, 35.0, 7.5, 7.5, 32.5, 40.0], ...
't', { {'North', 'N-E', 'East', 'S-E', 'South', 'S-W', 'West', 'N-W'} }, ...
'name', '5-8 m/s', ...
'marker', struct('color', 'rgb(203,201,226)'), ...
'type', 'area');
trace4 = struct(...
'r', [20.0, 7.5, 15.0, 22.5, 2.5, 2.5, 12.5, 22.5], ...
't', { {'North', 'N-E', 'East', 'S-E', 'South', 'S-W', 'West', 'N-W'} }, ...
'name', '< 5 m/s', ...
'marker', struct('color', 'rgb(242,240,247)'), ...
'type', 'area');
data = {trace1, trace2, trace3, trace4};
layout = struct(...
'title', 'Wind Speed Distribution in Laurel, NE', ...
'font', struct('size', 16), ...
'legend', struct('font', struct('size', 16)), ...
'radialaxis', struct('ticksuffix', '%'), ...
'orientation', 270);
response = plotly(data, struct('layout', layout, 'filename', 'polar-area-chart', 'fileopt', 'overwrite'));
plot_url = response.url
tls.embed('PlotBot', '37')
When you call a graph with iplot
it draws the graph and embeds the graph in an iframe in your NB. You control the privacy of your downloadable plots. Plots are also stored on Instagram-esque profiles at, for example, plot.ly/~IPython.Demo.
You can then keep all your your data, scripts, and graphs together online, and do your collaboration there as well. Adding IPython and Plotly to your workflow means you can create, execute, save, and publish images, Markdown, code, graphs, and text all together online. See below for a bit of illustration.
We'd love to hear your thoughts. We're at feedback@plot.ly and @plotlygraphs. Happy plotting.
from IPython.display import display, HTML
import urllib2
display(HTML( urllib2.urlopen('https://raw.githubusercontent.com/plotly/python-user-guide/master/custom.css').read()))