Python allows to build 3D charts thanks to the mplot3d toolkit of the matplotlib library. However, please note that 3d charts are most often a bad practice. This section focuses on 3d scatter plots and surface plots that are some interesting use cases.
The mplot3d toolkit of matplotlib is used here.
Three dimensional objects are very popular but negatively affect the accuracy and speed at which one can interpret a graphic in most cases.
In the example below, the brown section in front looks much bigger than the pink section in the back, even tough their real values are 30% vs 35%. Data is distorted.
Full articleNote: remember pie charts should be avoided most of the time
As described in the quick start section above, a three dimensional can be built with python thanks to themplot3d toolkit of matplotlib. The example below will guide you through its usage to get this figure:
This technique is useful to visualize the result of a PCA (Principal Component Analysis). The following example explains how to run a PCA with python and check its result with a 3d scatterplot:
A surface plot considers the X and Y coordinates as latitude and longitude, and Z as the altitude. It represents the dataset as a surface by interpolating positions between data points.
This kind of chart can also be done thanks to the mplot3d toolkit of matplotlib. The posts linked below explain how to use and customize the trisurf() function that is used for surface plots.
You can build an animation from a 3d chart by changing the camera position at each iteration of a loop. The example below explains how to do it for a surface plot but visit the animation section for more.
Animation sectionDo you know all the chart types? Do you know which one you should pick? I made a decision tree that answers those questions. You can download it for free!