Plotly Graphs with Domino’s New R Notebook
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
by Matt Sundquist
co-founder of Plotly
Domino's new R Notebook and Plotly's R API let you code, make interactive R and ggplot2 graphs, and collaborate entirely online. Here is the Notebook in action:
Published R Notebook
To execute this Notebook, or to build your own, head to Domino's Plotly Project. 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 Domino On-Premise and Plotly Enterprise.
Overlaid Histogram
This plot, like the rest in this post, was made in the R Notebook 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 GitHub page to see our ggplot2 support.
Anscombe's Quartet
Next up, let's visualize Anscombe's Quartet. Head to the R Notebook to see the R code for this.
Bar Charts
Interactive bar charts let you hover and filter. Press the legend items to filter the plot. Head to the R Notebook to see the code.
3D Plots
Plotly and Domino let you transition ggplot2 plots into interactive 3D plots. Head to the R Notebook to see the code.
Error Bars
If you use error bars, you can see the values when you hover your mouse. Head to the R Notebook to see the code.
Dendrograms
We can also make dendrograms; this example uses ggdendro and ggplot2. Head to the R Notebook to see the example.
Box plots
You can make interactive box plots from ggplot2 and share them.
Usage
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.
Plotly graphs can be embedded in Notebooks, dashboards, HTML, knitr, or Shiny. Every Plotly graph can be exported in varied programming languages and image types. For example, for the boxplot above:
- https://plot.ly/~r_user_guide/1079.png
- https://plot.ly/~r_user_guide/1079.svg
- https://plot.ly/~r_user_guide/1079.pdf
- https://plot.ly/~r_user_guide/1079.eps
- https://plot.ly/~r_user_guide/1079.py
- https://plot.ly/~r_user_guide/1079.m
- https://plot.ly/~r_user_guide/1079.jl
- https://plot.ly/~r_user_guide/1079.json
- https://plot.ly/~r_user_guide/1079.embed
This is our first pass at showing how you can use Domino and Plotly for coding and plotting in R. Have ideas? Suggestions? Other collaboration or Notebook projects you'd like to see? We're at @DominoDataLab and @DominoDataLab and welcome your suggestions.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.