- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to plot a plane using some mathematical equation in matplotlib?
To plot a plane using some mathematical equation in matplotlib, we can take the following steps.
Steps
Set the figure size and adjust the padding between and around the subplots.
Create x and y data points using numpy.
Using x and y, find the equation of the plane (eq).
Create a new figure or activate an existing figure.
Get the current axis with projection='3d'.
Create a surface plot with x, y and eq data points.
To display the figure, use Show() method.
Example
import numpy as np import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True x = np.linspace(-10, 10, 100) y = np.linspace(-10, 10, 100) x, y = np.meshgrid(x, y) eq = 0.12 * x + 0.01 * y + 1.09 fig = plt.figure() ax = fig.gca(projection='3d') ax.plot_surface(x, y, eq) plt.show()
Output
It will produce the following output −
- Related Articles
- How to add a mathematical expression in axis label in a plot created by using plot function in R?
- How to plot a wav file using Matplotlib?
- How to get a Gantt plot using matplotlib?
- How to plot a kernel density plot of dates in Pandas using Matplotlib?
- How to plot MFCC in Python using Matplotlib?
- How to plot vectors in Python using Matplotlib?
- How to plot collections.Counter histogram using Matplotlib?
- How to a plot stem plot in Matplotlib Python?
- How to rotate the rectangle patch in a plot using Matplotlib?
- How to make a quiver plot in polar coordinates using Matplotlib?
- How to Plot Cluster using Clustermaps class in Matplotlib
- How to plot an array in Python using Matplotlib?
- How to plot events on time using Matplotlib?
- How to plot 3D graphs using Python Matplotlib?
- How to plot 2d FEM results using matplotlib?

Advertisements