- 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
What is the equivalent of Matlab's surf(x,y,z,c) in Matplotlib?
Let's take an example to see how to get the same effect as MatLab's surf(x,y,z,c) in Matplotlib. steps −
Set the figure size and adjust the padding between and around the subplots.
Create a new figure or activate an existing figure.
Add an 'ax' to the figure as part of a subplot arrangement.
Create r, u, v, x, y and z data points using Numpy.
Create a surface plot.
To display the figure, use show() method.
Example
import matplotlib.pyplot as plt import numpy as np plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True fig = plt.figure() ax = fig.add_subplot(projection='3d') r = 0.05 u, v = np.mgrid[0:2 * np.pi:30j, 0:np.pi:20j] x = np.cos(u) * np.sin(v) y = np.sin(u) * np.sin(v) z = np.cos(v) ax.plot_surface(x, y, z, cmap=plt.cm.YlGnBu_r) plt.show()
Output
- Related Articles
- Equivalent to matlab's imagesc in Matplotlib
- What's the Kotlin equivalent of Java's String[]?
- What is the C# equivalent to Java's isInstance()?
- MySQL where column = 'x, y, z'?
- What is the PHP equivalent of MySQL's UNHEX()?
- What is the Java equivalent to MySQL's smallint?
- C# equivalent to Java's Thread.setDaemon?
- Subtract $3 x y+5 y z-7 z x$ from $5 x y-2 y z-2 z x+10 x y z$.
- In ( Delta X Y Z, X Y=X Z ). A straight line cuts ( X Z ) at ( P, Y Z ) at ( Q ) and ( X Y ) produced at ( R ). If ( Y Q=Y R ) and ( Q P=Q Z ), find the angles of ( Delta X Y Z ).
- Subtract x²-y²+z² from x²-y²- z²
- Kotlin equivalent of Java's equalsIgnoreCase
- Verify that ( x^{3}+y^{3}+z^{3}-3 x y z=frac{1}{2}(x+y+z)left[(x-y)^{2}+(y-z)^{2}+(z-x)^{2}right] )
- If ( x+y+z=0 ), show that ( x^{3}+y^{3}+z^{3}=3 x y z ).
- C# Equivalent to Java's Double Brace Initialization?
- Find x, y, z that satisfy 2/n = 1/x + 1/y + 1/z in C++

Advertisements