Creating 3D scatter plots

Scatter plots are very simple plots; for each point of your dataset, one point is shown in the figure. The coordinates of one point are simply the coordinates of the corresponding data. We have already explored scatter plots in two dimensions in Chapter 1, First Steps. In this recipe, we are going to see that scatter plots in three dimensions work the same way with just very minor changes.

In order to have some interesting data to visualize for this example, we are going to use the Lorenz strange attractor. This is a 3D structure that represents the solution of a simple dynamical system, coming from meteorology. This dynamical system is a famous textbook example of a chaotic system.

How to do it...

In the following code, ...

Get matplotlib Plotting Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.