December 2018
Beginner to intermediate
682 pages
18h 1m
English
In Chapter 6, Hello Plotting World!, we have already explored scatter plots in two dimensions. In this section, let's try to create a 3D scatter plot. Before doing that, we need some data points in three dimensions (x, y, z):
import pandas as pdsource = "https://raw.githubusercontent.com/PointCloudLibrary/data/master/tutorials/ism_train_cat.pcd"cat_df = pd.read_csv(source, skiprows=11, delimiter=" ", names=["x","y","z"], encoding='latin_1') cat_df.head()
| Point | x | y | z |
| 0 | -17.034178 | 18.972282 | 40.482403 |
| 1 | -16.881481 | 21.815451 | 44.156799 |
| 2 | -16.749582 | 18.154911 | 34.131474 |
| 3 | -16.876919 | 20.598286 | 36.271809 |
| 4 | -16.849340 | 17.403711 | 42.993984 |
To declare a 3D plot, we first need to import the Axes3D object from the mplot3d ...