R, Python, MATLAB, & Excel Dashboards & Graphs with D3.js & WebGL

April 29, 2015
By

(This article was first published on Modern Data » R, and kindly contributed to R-bloggers)

Web tools like D3.js and WebGL let you make beautiful, interactive 2D and 3D graphs. You can now publish graphs and dashboards with these technologies using Python, R, MATLAB, & Excel. Publishing and sharing is one extra line of code. This post puts you on your way, no downloads or installations required.

We’ll start with ggplot2; scroll to see Python and MATLAB plots in 2D and 3D. See our Enterprise page to learn how your industry uses Plotly.

Interactive R and ggplot2 plots

Plotly’s open-source ggplot2 figure converter draws an online version of the image below with one line of code. Click and drag to zoom, hover your mouse to see data, and press the legend to toggle traces on and off.

stat_smooth
ggplot2 plot

 

Copy and paste this code in your terminal to make the plot. Then embed in blogs, apps, knitrShiny dashboards, and R Notebooks. See our docs for more.

install.packages("devtools") # so we can install from github
library("devtools")
install_github("ropensci/plotly")
library(plotly)
 
py <- plotly(username="r_user_guide", key="mw5isa4yqp")  # plotly connection
 
c <- ggplot(mtcars, aes(qsec, wt))
c + stat_smooth() + geom_point()
py$ggplotly()  # call plotly

Interactive matplotlib and Python plots

We can similarly transform static matplotlib graphs into web-based, interactive graphs. See our IPython Notebook tutorial for the code. You can also interactively plot with pandas, ggplot2 for Python, prettyplotlib, and Seaborn. Then embed in websites, deploy a dashboard with plots, set your plots to update, or embed IPython widgets.

 

Interactive 3D MATLAB graphs

Our MATLAB figure converter works the same way. That is, make a MATLAB figure, add a line of code to make an interactive graph. Install the converter here; see our user guide to learn more and start streaming your data.

fig = figure;
[X,Y] = meshgrid(-8:.5:8);
R = sqrt(X.^2 + Y.^2) + eps;
Z = sin(R)./R;
surf(Z)
p = fig2plotly(fig);

 

 

Wrapping It All Together

You can easily share your plots, data, and interactive figures with others who need to view or edit with you. Share plots publicly via URL or privately with collaborators. We can make 3D graphs with Python and R and convert Excel graphs into online graphs. For sensitive data, try Plotly On-Premise to power your collaboration.

Our docs demonstrate how multiple users can edit together (like a Google Document). See our tutorials to get started, then embed your interactive plots in other dashboards, apps, or websites.

 

matplotlib and GUI

 

 

 

To leave a comment for the author, please follow the link and comment on their blog: Modern Data » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)