3D Graphing & Maps For Excel, R, Python, & MATLAB: Gender & Jobs, a 3D Gaussian, Alcohol, & Random Walks

July 1, 2015
By

(This article was first published on Plotly Blog, and kindly contributed to R-bloggers)

Showing a third dimension on a flat computer screen is usually hard. Plotly’s interactive 3D graphing changes that. You can zoom, toggle, pan, rotate, spin, see data on the hover, and more. In this post we’ll make 3D graphs with our APIs for Python, R, MATLAB, and Excel. Check out the links, our documentation or our tutorials to learn more and start embedding your plots. If you want to use Plotly on-premise with your team, contact us to start a free Plotly Enterprise trial today.

3D Maps & Alcohol Consumption with Python

We can now use Python to make bubble maps, choropleth maps, maps with lines, and scatter plots on maps. These IPython Notebooks show more. We rely on country codes published by the International Organization for Standardization. You can edit the scope, focus, style, and more in the Plotly Python API or web app. For example, the alcohol consumption map below was originally made using Plotly’s Robinson style. We can re-make the plot from the API or edit it in the web app. Click and drag to spin, hover for data, or scroll to zoom.

Pure alcohol consumption among adults (age 15+) in 2010

A 3D Gaussian Plot with MATLAB

Named after mathematician Carl Friedrich Gauss, a Gaussian shows a “bell curve” shape. You can use Plotly’s line of best tools to apply a Gaussian fit to your data, like this histogram of NHL Player height. The Gaussian fit is the dashed line; see our tutorial to learn more.

2013 NHL PLAYER HEIGHT" style="display: block; text-align: center;">2013 NHL PLAYER HEIGHT" style="max-width: 100%;width: 1043px;" width="450" onerror="this.onerror=null;this.src='https://plot.ly/404.png';"/>

We’ve used MATLAB to plot a 3D Gaussian. Below find the original version, and a version we made with the Plotly MATLAB API by adding one line of code. If you hover your mouse, you’ll see the precise data for where you’ve hovered. Plotly also projects spikes to show precisely where on an axis a given data point lies.


Excel in 3D: Professional Prestige, Education, & Income

You can also make 3D plots by uploading Excel data. Learn more in our tutorial and see how to make the plot below with our web app.

The prestige score, educational level, and incomes of different jobs are plotted below, sorted by men and women. If you hover your mouse, you’ll see which job is associated with each dot. Click and drag to spin, and toggle traces on and off by clicking the legend items. The points are projected onto the axes of the plot with light opacity.

Prestige, Education, & Income for Profressions" style="display: block; text-align: center;">Prestige, Education, & Income for Profressions" style="max-width: 100%;width: 800px;" width="450" onerror="this.onerror=null;this.src='https://plot.ly/404.png';"/>

For more Excel uses, try the Plotly Excel Plugin and Plotly PowerPoint App to embed interactive Plotly graphs in PowerPoint presentations. You can see text on the hover, zoom, and pan from within PowerPoint.

Random Walking in 3D with R

Using Plotly’s R API, we can make a 3D plot of a random walk. A random walk is a mathematical formalization used to simulate molecules in gas, a foraging animal, stock prices, and more as a modeled event. Here’s how one looks in 2D:

trace 0, trace 1, trace 2, trace 3

We can use Plotly’s R API to simulate a random walk in 3D. Note how the plot uses a color scale to simulate the passage of time.

y

If you liked what you read, please consider sharing. Find us at [email protected] and @plotlygraphs.

To leave a comment for the author, please follow the link and comment on their blog: Plotly Blog.

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)