7 Plotly Graphs in 3D: Stocks, Cats, and Lakes

Plotly now lets you make 3D scatter, line, and surface plots. When might you use a 3D plot? When you have data with three dimensions–x, y, and z data. For example, if you are graphing mathematical functions, examining the depth of a lake or height of a mountain, or modeling multiple dimensions in the stock market. Read on to learn how to make those plots. You can see our web tutorials and Python tutorial to learn more. Here are a few examples:









3D Surface Plots

3D plots are useful for modeling three dimensional spaces. This plot shows the depth of water in a lake, and was originally created as a contour plot. Transitions to 3D plots from heatmaps and contour plots are possible from the Plotly web app, as shown below. For more, see our docs for a plot of a mountain.

















Next up, a function plotted by Plotly engineer Étienne Tétreault-Pinard. Visit our Python tutorial to see the code to make the plot. The text in the title is LaTeX, written as:

$f(x,y) = A \cos(\pi x y) e^{-(x^2+y^2)/2}$







Below find a forked version of investor Kai Wu’s 3D volatility surface. In finance, 3D plots create a volatility surface to plot implied volatility. We plot the z axis as a function of “moneyness”, “strike”, or “delta”. The y axis shows duration. We use the Black-Scholes partial differential equation to calculate the implied volatility on the x axis, defined as: \[ \frac{\partial C}{\partial t} + rS\frac{\partial C}{\partial S} + \frac{1}{2}\sigma^2S^2\frac{\partial^2 C}{\partial S^2}=rC$ \]







3D Line Plots



The Lorenz attractor is our first line plot, made by Plotly’s CEO Jack Parmer. The Lorenz system is a system of ordinary differential equations (the Lorenz equations) first studied by Edward Lorenz. It is notable for having chaotic solutions for certain parameter values and initial conditions. In particular, the Lorenz attractor is a set of chaotic solutions of the Lorenz system which, when plotted, resemble a butterfly or figure eight. See our docs for more code. We can also use Plotly’s live-streaming API to make a streaming version of this plot.







This seasonal plot, crafted by Plotly’s CTO Alex Johnson demonstrates another possible customization: turning off spikes (the lines that hover when you mouse over your plot). Click through to the URL if you’d like to edit your own version, play with the data, or view another version in full-screen: https://plot.ly/~alex/460.









3D Scatter Plots

This scatter plot was made with the Plotly MATLAB API by Plotly engineer Chuck Bronson. If you go to the plot URL and zoom in, you can immerse yourself in the dots.







Out of respect for the owners of the internet, Plotly engineer Jody Mcintyre plotted cats in 3D. Zoom in for more detail.







If you want help making a 3D graph or have questions or feedback, you can email us at feedback at plot dot ly or find us on Twitter at @plotlygraphs.

To make a plot, pick “3D scatter plot” from the drop-down menu in Plotly’s grid, and select the relevant x, y, and z columns. The z axis is key for a 3D plot. Pressing the blue 3D scatter plot button creates a plot, which you can style.