3D Graphing & Maps For Excel, R, Python, & MATLAB: Gender & Jobs, a 3D Gaussian, Alcohol, & Random Walks
[This article was first published on Plotly Blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
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.
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.
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.
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:
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.
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 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.