Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bb8675c

Browse files
committed
Add 3d surface plot example (radial coordinates)
svn path=/branches/v0_99_maint/; revision=8197
1 parent b60d7d8 commit bb8675c

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# By Armin Moser
2+
3+
from mpl_toolkits.mplot3d import Axes3D
4+
import matplotlib
5+
import numpy as np
6+
from matplotlib import cm
7+
from matplotlib import pyplot as plt
8+
step = 0.04
9+
maxval = 1.0
10+
fig = plt.figure()
11+
ax = Axes3D(fig)
12+
13+
# create supporting points in polar coordinates
14+
r = np.linspace(0,1.25,50)
15+
p = np.linspace(0,2*np.pi,50)
16+
R,P = np.meshgrid(r,p)
17+
# transform them to cartesian system
18+
X,Y = R*np.cos(P),R*np.sin(P)
19+
20+
Z = ((R**2 - 1)**2)
21+
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet)
22+
ax.set_zlim3d(0, 1)
23+
ax.set_xlabel(r'$\phi_\mathrm{real}$')
24+
ax.set_ylabel(r'$\phi_\mathrm{im}$')
25+
ax.set_zlabel(r'$V(\phi)$')
26+
ax.set_xticks([])
27+
plt.show()

0 commit comments

Comments
 (0)