Skip to content

Instantly share code, notes, and snippets.

@msund
Created January 27, 2015 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msund/2876259bdff23164576c to your computer and use it in GitHub Desktop.
Save msund/2876259bdff23164576c to your computer and use it in GitHub Desktop.
Mountains in 3D
{
"metadata": {
"name": "",
"signature": "sha256:15fd2371553953bcf0af1f468b8ba403a3efd0f6e14d36f8fb29441b703324f4"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"import plotly.plotly as py"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"MattSundquist2509 = py.get_figure('https://plot.ly/~MattSundquist/2509')\n",
"MattSundquist2444 = py.get_figure('https://plot.ly/~MattSundquist/2444')\n",
"MattSundquist2160 = py.get_figure('https://plot.ly/~MattSundquist/2160/_2013')\n",
"MattSundquist6138 = py.get_figure('https://plot.ly/~MattSundquist/6138')"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 23
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"def set_scene_key(data, scene_key):\n",
" for trace in data:\n",
" trace.update({'scene': scene_key})\n",
" return [trace for trace in data]\n",
"\n",
"data = (\n",
" set_scene_key(MattSundquist2509['data'], 'scene') +\n",
" set_scene_key(MattSundquist2444['data'], 'scene2') +\n",
" set_scene_key(MattSundquist2160['data'], 'scene3') +\n",
" set_scene_key(MattSundquist6138['data'], 'scene4')\n",
")"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 24
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"def set_scene_domain(scene_layout, domain):\n",
" scene_layout.update({'domain': domain})\n",
" return scene_layout\n",
"\n",
"layout = dict(\n",
" title='3D graph Hall of Fame',\n",
" scene=set_scene_domain(MattSundquist2509['layout']['scene'], \n",
" {'x': [0,0.5], 'y':[0.5,1]}),\n",
" scene2=set_scene_domain(MattSundquist2444['layout']['scene'], \n",
" {'x': [0.5,1], 'y':[0.5,1]}),\n",
" scene3=set_scene_domain(MattSundquist2160['layout']['scene'], \n",
" {'x': [0,0.5], 'y':[0,0.5]}),\n",
" scene4=set_scene_domain(MattSundquist6138['layout']['scene'], \n",
" {'x': [0.5,1], 'y':[0,0.5]}),\n",
")"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 25
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"fig = dict(data=data, layout=layout)\n",
"py.iplot(fig, validate=False, filename='all-out-combo')"
],
"language": "python",
"metadata": {},
"outputs": [
{
"application/pdf": "PCFET0NUWVBFIGh0bWw+CjxodG1sPgoJVWggb2guIExvb2tzIGxpa2UgYW4gZXJyb3Igb2NjdXJy\nZWQgcHJvY2Vzc2luZyB0aGlzIHJlcXVlc3QuIFdlJ2xsIGJlIHdvcmtpbmcgb24gZml4aW5nIHRo\naXMuIFlvdSBjYW4gdHJ5IGFnYWluIHNvb24gb3IgY29udGFjdCB1cyBhdCBmZWVkYmFja0BwbG90\nLmx5LiBUaGFua3MgZm9yIHlvdXIgcGF0aWVuY2UgYW5kIHNvcnJ5IGZvciB0aGUgZGVsYXkuIEhh\ncHB5IHBsb3R0aW5nLgo8L2h0bWw+Cg==\n",
"html": [
"<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\"seamless=\"seamless\" src=\"https://plot.ly/~MattSundquist/6142.embed\" height=\"525\" width=\"100%\"></iframe>"
],
"jpeg": "PCFET0NUWVBFIGh0bWw+CjxodG1sPgoJVWggb2guIExvb2tzIGxpa2UgYW4gZXJyb3Igb2NjdXJy\nZWQgcHJvY2Vzc2luZyB0aGlzIHJlcXVlc3QuIFdlJ2xsIGJlIHdvcmtpbmcgb24gZml4aW5nIHRo\naXMuIFlvdSBjYW4gdHJ5IGFnYWluIHNvb24gb3IgY29udGFjdCB1cyBhdCBmZWVkYmFja0BwbG90\nLmx5LiBUaGFua3MgZm9yIHlvdXIgcGF0aWVuY2UgYW5kIHNvcnJ5IGZvciB0aGUgZGVsYXkuIEhh\ncHB5IHBsb3R0aW5nLgo8L2h0bWw+Cg==\n",
"metadata": {},
"output_type": "pyout",
"png": "PCFET0NUWVBFIGh0bWw+CjxodG1sPgoJVWggb2guIExvb2tzIGxpa2UgYW4gZXJyb3Igb2NjdXJy\nZWQgcHJvY2Vzc2luZyB0aGlzIHJlcXVlc3QuIFdlJ2xsIGJlIHdvcmtpbmcgb24gZml4aW5nIHRo\naXMuIFlvdSBjYW4gdHJ5IGFnYWluIHNvb24gb3IgY29udGFjdCB1cyBhdCBmZWVkYmFja0BwbG90\nLmx5LiBUaGFua3MgZm9yIHlvdXIgcGF0aWVuY2UgYW5kIHNvcnJ5IGZvciB0aGUgZGVsYXkuIEhh\ncHB5IHBsb3R0aW5nLgo8L2h0bWw+Cg==\n",
"prompt_number": 26,
"svg": [
"<!DOCTYPE html>\n",
"<html>\n",
"\tUh oh. Looks like an error occurred processing this request. We'll be working on fixing this. You can try again soon or contact us at feedback@plot.ly. Thanks for your patience and sorry for the delay. Happy plotting.\n",
"</html>\n"
],
"text": [
"<plotly.tools.PlotlyDisplay at 0x107d1cd90>"
]
}
],
"prompt_number": 26
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from IPython.display import display, HTML\n",
"import urllib2\n",
"url = 'https://raw.githubusercontent.com/plotly/python-user-guide/master/custom.css'\n",
"display(HTML(urllib2.urlopen(url).read()))"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
"<style>\n",
" div.cell{\n",
" width: 850px;\n",
" margin-left: 10% !important;\n",
" margin-right: auto;\n",
" }\n",
" h1 {\n",
" font-family: \"Open sans\",verdana,arial,sans-serif;\n",
" }\n",
" .text_cell_render h1 {\n",
" font-weight: 200;\n",
" font-size: 40pt;\n",
" line-height: 100%;\n",
" color:#447adb;\n",
" margin-bottom: 0em;\n",
" margin-top: 0em;\n",
" display: block;\n",
" white-space: nowrap;\n",
" } \n",
" h2 {\n",
" font-family: \"Open sans\",verdana,arial,sans-serif;\n",
" text-indent:1em;\n",
" }\n",
" .text_cell_render h2 {\n",
" font-weight: 200;\n",
" font-size: 20pt;\n",
" font-style: italic;\n",
" line-height: 100%;\n",
" color:#447adb;\n",
" margin-bottom: 1.5em;\n",
" margin-top: 0.5em;\n",
" display: block;\n",
" white-space: nowrap;\n",
" } \n",
" h3 {\n",
" font-family: \"Open sans\",verdana,arial,sans-serif;\n",
" }\n",
" .text_cell_render h3 {\n",
" font-weight: 300;\n",
" font-size: 18pt;\n",
" line-height: 100%;\n",
" color:#447adb;\n",
" margin-bottom: 0.5em;\n",
" margin-top: 2em;\n",
" display: block;\n",
" white-space: nowrap;\n",
" }\n",
" h4 {\n",
" font-family: \"Open sans\",verdana,arial,sans-serif;\n",
" }\n",
" .text_cell_render h4 {\n",
" font-weight: 300;\n",
" font-size: 16pt;\n",
" color:#447adb;\n",
" margin-bottom: 0.5em;\n",
" margin-top: 0.5em;\n",
" display: block;\n",
" white-space: nowrap;\n",
" }\n",
" h5 {\n",
" font-family: \"Open sans\",verdana,arial,sans-serif;\n",
" }\n",
" .text_cell_render h5 {\n",
" font-weight: 300;\n",
" font-style: normal;\n",
" color: #1d3b84;\n",
" font-size: 16pt;\n",
" margin-bottom: 0em;\n",
" margin-top: 1.5em;\n",
" display: block;\n",
" white-space: nowrap;\n",
" }\n",
" div.text_cell_render{\n",
" font-family: \"Open sans\",verdana,arial,sans-serif;\n",
" line-height: 135%;\n",
" font-size: 125%;\n",
" width:750px;\n",
" margin-left:auto;\n",
" margin-right:auto;\n",
" text-align:justify;\n",
" text-justify:inter-word;\n",
" }\n",
" div.output_subarea.output_text.output_pyout {\n",
" overflow-x: auto;\n",
" overflow-y: scroll;\n",
" max-height: 300px;\n",
" }\n",
" div.output_subarea.output_stream.output_stdout.output_text {\n",
" overflow-x: auto;\n",
" overflow-y: scroll;\n",
" max-height: 300px;\n",
" }\n",
" div.output_subarea.output_html.rendered_html {\n",
" overflow-x: scroll;\n",
" max-width: 100%;\n",
" /* overflow-y: scroll; */\n",
" /* max-height: 300px; */\n",
" }\n",
" code{\n",
" font-size: 78%;\n",
" }\n",
" .rendered_html code{\n",
" background-color: transparent;\n",
" white-space: inherit; \n",
" }\n",
" ul{\n",
" /* color:#447adb; */ \n",
" margin: 2em;\n",
" }\n",
" ul li{\n",
" padding-left: 0.5em; \n",
" margin-bottom: 0.5em; \n",
" margin-top: 0.5em; \n",
" }\n",
" ul li li{\n",
" padding-left: 0.2em; \n",
" margin-bottom: 0.2em; \n",
" margin-top: 0.2em; \n",
" }\n",
" ol{\n",
" /* color:#447adb; */ \n",
" margin: 2em;\n",
" }\n",
" ol li{\n",
" padding-left: 0.5em; \n",
" margin-bottom: 0.5em; \n",
" margin-top: 0.5em; \n",
" }\n",
" /*.prompt{\n",
" display: None;\n",
" } */\n",
" ul li{\n",
" padding-left: 0.5em; \n",
" margin-bottom: 0.5em; \n",
" margin-top: 0.2em; \n",
" }\n",
" a:link{\n",
" font-weight: bold;\n",
" color:#447adb;\n",
" }\n",
" a:visited{\n",
" font-weight: bold;\n",
" color: #1d3b84;\n",
" }\n",
" a:hover{\n",
" font-weight: bold;\n",
" color: #1d3b84;\n",
" }\n",
" a:focus{\n",
" font-weight: bold;\n",
" color:#447adb;\n",
" }\n",
" a:active{\n",
" font-weight: bold;\n",
" color:#447adb;\n",
" }\n",
" .rendered_html :link {\n",
" text-decoration: none; \n",
" }\n",
" .rendered_html :hover {\n",
" text-decoration: none; \n",
" }\n",
" .rendered_html :visited {\n",
" text-decoration: none;\n",
" }\n",
" .rendered_html :focus {\n",
" text-decoration: none;\n",
" }\n",
" .rendered_html :active {\n",
" text-decoration: none;\n",
" }\n",
" .warning{\n",
" color: rgb( 240, 20, 20 )\n",
" } \n",
" hr {\n",
" color: #f3f3f3;\n",
" background-color: #f3f3f3;\n",
" height: 1px;\n",
" }\n",
" blockquote{\n",
" display:block;\n",
" background: #f3f3f3;\n",
" font-family: \"Open sans\",verdana,arial,sans-serif;\n",
" width:610px;\n",
" padding: 15px 15px 15px 15px;\n",
" text-align:justify;\n",
" text-justify:inter-word;\n",
" }\n",
" blockquote p {\n",
" margin-bottom: 0;\n",
" line-height: 125%;\n",
" font-size: 100%;\n",
" text-align: center;\n",
" }\n",
" /* element.style {\n",
" } */ \n",
"</style>\n",
"<script>\n",
" MathJax.Hub.Config({\n",
" TeX: {\n",
" extensions: [\"AMSmath.js\"]\n",
" },\n",
" tex2jax: {\n",
" inlineMath: [ [\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"] ],\n",
" displayMath: [ [\"$$\",\"$$\"], [\"\\\\[\",\"\\\\]\"] ]\n",
" },\n",
" displayAlign: \"center\", // Change this to \"center\" to center equations.\n",
" \"HTML-CSS\": {\n",
" styles: {\".MathJax_Display\": {\"margin\": 4}}\n",
" }\n",
" });\n",
"</script>\n"
],
"metadata": {},
"output_type": "display_data",
"text": [
"<IPython.core.display.HTML at 0x107d1cad0>"
]
}
],
"prompt_number": 27
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment