Last active
August 29, 2015 14:18
-
-
Save mkcor/67bd4442af76501e3fab to your computer and use it in GitHub Desktop.
Notebook with R kernel to show collaborative workflow
This file contains hidden or 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:b9510236f1c17ecd4d47453758b680d96e343f2307fa5283cebd43ae34278215" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Show extensions...\n", | |
"\n", | |
"https://plot.ly/~marianne2/1123.embed\n", | |
"\n", | |
"https://plot.ly/~marianne2/1123.svg\n", | |
"\n", | |
"https://plot.ly/~marianne2/1123.json\n", | |
"\n", | |
"https://plot.ly/~marianne2/1123.r" | |
] | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 6, | |
"metadata": {}, | |
"source": [ | |
"Retrieve your plot in R" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"library(plotly)" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stderr", | |
"text": [ | |
"packageStartupMessage in packageStartupMessage(gettextf(\"Loading required package: %s\", : Loading required package: RCurl\n", | |
"\n" | |
] | |
}, | |
{ | |
"output_type": "stream", | |
"stream": "stderr", | |
"text": [ | |
"packageStartupMessage in packageStartupMessage(gettextf(\"Loading required package: %s\", : Loading required package: bitops\n", | |
"\n" | |
] | |
}, | |
{ | |
"output_type": "stream", | |
"stream": "stderr", | |
"text": [ | |
"packageStartupMessage in packageStartupMessage(gettextf(\"Loading required package: %s\", : Loading required package: RJSONIO\n", | |
"\n" | |
] | |
}, | |
{ | |
"output_type": "stream", | |
"stream": "stderr", | |
"text": [ | |
"packageStartupMessage in packageStartupMessage(gettextf(\"Loading required package: %s\", : Loading required package: ggplot2\n", | |
"\n" | |
] | |
} | |
], | |
"prompt_number": 1 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"py <- plotly()" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 2 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"original <- py$get_figure(\"marianne2\", 1123)" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 3 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"# str(original)" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 4 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"typeof(original)" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 5, | |
"text": [ | |
"[1] \"list\"" | |
] | |
} | |
], | |
"prompt_number": 5 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"original$layout$annotations" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 6, | |
"text": [ | |
"[[1]]\n", | |
"[[1]]$opacity\n", | |
"[1] 1\n", | |
"\n", | |
"[[1]]$yanchor\n", | |
"[1] \"top\"\n", | |
"\n", | |
"[[1]]$xref\n", | |
"[1] \"paper\"\n", | |
"\n", | |
"[[1]]$xanchor\n", | |
"[1] \"right\"\n", | |
"\n", | |
"[[1]]$y\n", | |
"[1] 0.9561446\n", | |
"\n", | |
"[[1]]$yref\n", | |
"[1] \"paper\"\n", | |
"\n", | |
"[[1]]$text\n", | |
"[1] \"Color = imag(sig)<br>Size = real(sig)\"\n", | |
"\n", | |
"[[1]]$align\n", | |
"[1] \"right\"\n", | |
"\n", | |
"[[1]]$bgcolor\n", | |
"[1] \"rgba(0,0,0,0)\"\n", | |
"\n", | |
"[[1]]$textangle\n", | |
"[1] 0\n", | |
"\n", | |
"[[1]]$borderwidth\n", | |
"[1] 1\n", | |
"\n", | |
"[[1]]$bordercolor\n", | |
"[1] \"rgba(0,0,0,0)\"\n", | |
"\n", | |
"[[1]]$x\n", | |
"[1] 0.9574263\n", | |
"\n", | |
"[[1]]$font\n", | |
"[[1]]$font$color\n", | |
"[1] \"#444\"\n", | |
"\n", | |
"[[1]]$font$family\n", | |
"[1] \"\\\"Open sans\\\", verdana, arial, sans-serif\"\n", | |
"\n", | |
"[[1]]$font$size\n", | |
"[1] 12\n", | |
"\n", | |
"\n", | |
"[[1]]$borderpad\n", | |
"[1] 1\n", | |
"\n", | |
"[[1]]$showarrow\n", | |
"[1] FALSE\n", | |
"\n" | |
] | |
} | |
], | |
"prompt_number": 6 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"copy <- original" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 7 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"copy$layout$annotations[[1]]$font$size # Look up a layout attribute" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 8, | |
"text": [ | |
"[1] 12" | |
] | |
} | |
], | |
"prompt_number": 8 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"copy$layout$annotations[[1]]$font$size <- 14" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 9 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"original$layout$annotations[[1]]$font$size" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 10, | |
"text": [ | |
"[1] 12" | |
] | |
} | |
], | |
"prompt_number": 10 | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Note the difference with respect to Python." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"copy$data[[1]]$x[1:10] # Inspect data" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 11, | |
"text": [ | |
" [1] 0.000000000 0.002506266 0.005012531 0.007518797 0.010025063 0.012531328\n", | |
" [7] 0.015037594 0.017543860 0.020050125 0.022556391" | |
] | |
} | |
], | |
"prompt_number": 11 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"plot2 <- py$plotly(copy$data, kwargs=list(layout=copy$layout, filename='oscillator2', fileopt='overwrite'))" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 12 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"plot2$url" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 13, | |
"text": [ | |
"[1] \"https://plot.ly/~marianne2/1129\"" | |
] | |
} | |
], | |
"prompt_number": 13 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"py$irplot(copy$data, kwargs=list(layout=copy$layout, filename='oscillator2', fileopt='overwrite'))" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stderr", | |
"text": [ | |
"packageStartupMessage in packageStartupMessage(gettextf(\"Loading required package: %s\", : Loading required package: IRdisplay\n", | |
"\n" | |
] | |
}, | |
{ | |
"html": [ | |
"<iframe height=\"525\" id=\"igraph\" scrolling=\"no\" seamless=\"seamless\"\n", | |
"\t\t\t\tsrc=\"https://plot.ly/~marianne2/1129\" width=\"100%\" frameBorder=\"0\"></iframe>" | |
], | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"prompt_number": 14 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 15 | |
} | |
], | |
"metadata": {} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment