Skip to content

Instantly share code, notes, and snippets.

@msund
Created February 27, 2015 21:29
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/e77538a6c6116573ad00 to your computer and use it in GitHub Desktop.
Save msund/e77538a6c6116573ad00 to your computer and use it in GitHub Desktop.
Post
Domino's new <a href="http://blog.dominodatalab.com/r-notebooks/">R Notebook</a> and <a href="https://plot.ly/ggplot2">Plotly's R API</a> let you code, make interactive R and ggplot2 graphs, and collaborate entirely online. Here is the Notebook in action:
<br>
<br>
<br>
<a href="http://nbviewer.ipython.org/gist/msund/d3e00e5e27dff31a7b6d">Published R Notebook</a>
<br>
<br>
<br>
To execute this Notebook or build your own head to <a href="https://app.dominodatalab.com/nick/plotly">Domino's Plotly Project</a>. The GIF below shows how to get started: choose an R session, press "Open Notebook", and choose the "R Notebook" file. For sensitive data, see <a href="http://www.dominodatalab.com/on_premise">Domino On-Premise</a> and <a href="https://plot.ly/product/enterprise/">Plotly Enterprise</a>.
<br>
<br>
<br>
<img src="http://i.imgur.com/5bYoZlk.gif" /></a>
<br>
<br>
<br>
<h2>Overlad Histogram</h2>
<br>
<br>
<br>
This plot, like the rest in this post, was made in <a href="http://nbviewer.ipython.org/gist/msund/d3e00e5e27dff31a7b6d">the R Notebook</a> with ggplot2, then converted to an interactive plot with one line of code. The plot is drawn with D3.js. You can hover your mouse to see text, click and drag to zoom, and toggle traces on and off by clicking them in the legend. check out our <a href="https://github.com/ropensci/plotly/issues">GitHub page</a> to see our ggplot2 support.
<br>
<br>
<br>
<div>
<a href="https://plot.ly/~r_user_guide/994/" target="_blank" title="count vs xx" style="display: block; text-align: center;"><img src="https://plot.ly/~r_user_guide/994.png" alt="count vs xx" style="max-width: 100%;" onerror="this.onerror=null;this.src='https://plot.ly/404.png';" /></a>
<script data-plotly="r_user_guide:994" src="https://plot.ly/embed.js" async></script>
</div>
<br>
<br>
<br>
<h2>Anscombe's Quartet</h2>
<br>
<br>
<br>
Next up, let's visualize Anscombe's Quartet. Head to <a href="http://nbviewer.ipython.org/gist/msund/d3e00e5e27dff31a7b6d">the R Notebook</a> to see the R code for this.
<br>
<br>
<br>
<div>
<a href="https://plot.ly/~MattSundquist/2745/" target="_blank" title="Anscombe&#39;s quartet " style="display: block; text-align: center;"><img src="https://plot.ly/~MattSundquist/2745.png" alt="Anscombe&#39;s quartet " style="max-width: 100%;width: 1152px;" width="1152" onerror="this.onerror=null;this.src='https://plot.ly/404.png';" /></a>
<script data-plotly="MattSundquist:2745" src="https://plot.ly/embed.js" async></script>
</div>
<br>
<br>
<br>
<h2>Bar Charts</h2>
<br>
<br>
<br>
Interactive bar charts let you hover and filter. Press the legend items to filter the plot. Head to <a href="http://nbviewer.ipython.org/gist/msund/d3e00e5e27dff31a7b6d">the R Notebook</a> to see the code.
<br>
<br>
<br>
<div>
<a href="https://plot.ly/~r_user_guide/1167/" target="_blank" title="value/1e+06 vs Period" style="display: block; text-align: center;"><img src="https://plot.ly/~r_user_guide/1167.png" alt="value/1e+06 vs Period" style="max-width: 100%;" onerror="this.onerror=null;this.src='https://plot.ly/404.png';" /></a>
<script data-plotly="r_user_guide:1167" src="https://plot.ly/embed.js" async></script>
</div>
<br>
<br>
<br>
<h2>3D Plots</h2>
<br>
<br>
<br>
Plotly and Domino let you transition ggplot2 plots into interactive 3D plots. Head to <a href="http://nbviewer.ipython.org/gist/msund/d3e00e5e27dff31a7b6d">the R Notebook</a> to see the code.
<br>
<br>
<br>
<div>
<a href="https://plot.ly/~MattSundquist/8069/" target="_blank" title="3D Volcano" style="display: block; text-align: center;"><img src="https://plot.ly/~MattSundquist/8069.png" alt="3D Volcano" style="max-width: 100%;width: 818px;" width="818" onerror="this.onerror=null;this.src='https://plot.ly/404.png';" /></a>
<script data-plotly="MattSundquist:8069" src="https://plot.ly/embed.js" async></script>
</div>
<br>
<br>
<br>
<h2>Error Bars</h2>
<br>
<br>
<br>
If you use error bars, you can see the values when you hover your mouse. Head to <a href="http://nbviewer.ipython.org/gist/msund/d3e00e5e27dff31a7b6d">the R Notebook</a> to see the code.
<br>
<br>
<br>
<div>
<a href="https://plot.ly/~r_user_guide/1164/" target="_blank" title="F vs x" style="display: block; text-align: center;"><img src="https://plot.ly/~r_user_guide/1164.png" alt="F vs x" style="max-width: 100%;" onerror="this.onerror=null;this.src='https://plot.ly/404.png';" /></a>
<script data-plotly="r_user_guide:1164" src="https://plot.ly/embed.js" async></script>
</div>
<h2>Dendrograms</h2>
<br>
<br>
<br>
We can also make dendrograms; this example uses ggdendro and ggplot2. Head to <a href="http://nbviewer.ipython.org/gist/msund/d3e00e5e27dff31a7b6d">the R Notebook</a> to see the example.
<br>
<br>
<br>
<div>
<a href="https://plot.ly/~r_user_guide/1175/" target="_blank" title="y vs x" style="display: block; text-align: center;"><img src="https://plot.ly/~r_user_guide/1175.png" alt="y vs x" style="max-width: 100%;width: 1178px;" width="1178" onerror="this.onerror=null;this.src='https://plot.ly/404.png';" /></a>
<script data-plotly="r_user_guide:1175" src="https://plot.ly/embed.js" async></script>
</div>
<h2>Box plots</h2>
<br>
<br>
<br>
You can make interactive box plots from ggplot2 and share them.
<br>
<br>
<br>
<div>
<a href="https://plot.ly/~r_user_guide/1168/" target="_blank" title="rating vs cond" style="display: block; text-align: center;"><img src="https://plot.ly/~r_user_guide/1168.png" alt="rating vs cond" style="max-width: 100%;" onerror="this.onerror=null;this.src='https://plot.ly/404.png';" /></a>
<script data-plotly="r_user_guide:1168" src="https://plot.ly/embed.js" async></script>
</div>
<br>
<br>
<br>
<h2>Usage</h2>
<br>
<br>
<br>
Domino Notebooks can run Python, R, Julia, and Scala. Each Notebook can be shared in the Domino Cloud or exported as an IPython Notebook, HTML or reST file. Notebooks support LaTeX, and allow you to use Markdown, headers, import images, and display iframes.
<br>
<br>
<br>
Plotly graphs can be embedded in Notebooks, dashboards, HTML, <a href="http://blog.plot.ly/post/106630252117/plot-with-ggplot2-and-plotly-within-knitr-reports">knitr</a>, or <a href="https://github.com/chriddyp/plotly-shiny">Shiny</a>. Every Plotly graph can be exported in varied programming languages and image types. For example, for the boxplot above:
<br>
<br>
<br>
<ul>
<li> https://plot.ly/~r_user_guide/1079.png</li>
<li> https://plot.ly/~r_user_guide/1079.svg</li>
<li> https://plot.ly/~r_user_guide/1079.pdf</li>
<li> https://plot.ly/~r_user_guide/1079.eps</li>
<li> https://plot.ly/~r_user_guide/1079.py</li>
<li> https://plot.ly/~r_user_guide/1079.m</li>
<li> https://plot.ly/~r_user_guide/1079.jl</li>
<li> https://plot.ly/~r_user_guide/1079.json</li>
<li> https://plot.ly/~r_user_guide/1079.embed</li>
</ul>
<br>
<br>
<br>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment