Matplotlib was introduced keeping in mind, only two-dimensional plotting. But at the time when the release of 1.0 occurred, the 3d utilities were developed upon the 2d and thus, we have 3d implementation of data available today! The 3d plots are enabled by importing the mplot3d toolkit. Let’s look at a 3d contour diagram of a 3d cosine function. The code is attached for reference.
|meshgrid||Function of numpy used to create a rectangular grid out of two given one-dimensional arrays representing the Cartesian indexing or Matrix indexing|
|plt.axes()||To create object of the axis|
|ax.contour3D||To form the contour|
|ax.set_xlabel||To label the X-axis|
|ax.set_title||To give a title to the plot|
Example 2: Let’s look at another 3d diagram for better understanding of the concept. This time, of a 3d tan function.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Contour Plot using Matplotlib - Python
- Matplotlib.axes.Axes.contour() in Python
- Matplotlib.pyplot.contour() in Python
- Contour Plots using Plotly in Python
- Carpet Contour Plot using Plotly in Python
- Contour Detection with Custom Seeds using Python - OpenCV
- Surface plots and Contour plots in Python
- Exploration with Hexagonal Binning and Contour Plots
- 3D Wireframe plotting in Python using Matplotlib
- Python | Matplotlib Sub plotting using object oriented API
- Python | Matplotlib Graph plotting using object oriented API
- Plotting Histogram in Python using Matplotlib
- 3D Surface plotting in Python using Matplotlib
- 3D Scatter Plotting in Python using Matplotlib
- Plotting cross-spectral density in Python using Matplotlib
- Plotting Various Sounds on Graphs using Python and Matplotlib
- Three-dimensional Plotting in Python using Matplotlib
- Different plotting using pandas and matplotlib
- Plotting graph For IRIS Dataset Using Seaborn And Matplotlib
- Python | Plotting Google Map using gmplot package
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.