R, Python, MATLAB, & Excel Dashboards & Graphs with D3.js & WebGL
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
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.
Copy and paste this code in your terminal to make the plot. Then embed in blogs, apps, knitr, Shiny 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.
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.