2016-04-09 21 views
4

2D polar ısı haritası olarak paraboloid f (r) = r ** 2 çizimi yapmak istiyorum. Beklediğim çıkış enter image description herePython Kutupsal ısı eşlemeleri

yazdım kod

from pylab import* 
from mpl_toolkits.mplot3d import Axes3D 
ax = Axes3D(figure()) 
rad=linspace(0,5,100) 
azm=linspace(0,2*pi,100) 
r,th=meshgrid(rad,azm) 
z=(r**2.0)/4.0 
subplot(projection="polar") 
pcolormesh(r,th, z) 
show() 

olduğu Fakat bu programı aşağıdaki görüntüyü döndürür. enter image description here

Birisi yardımcı olabilir mi? Şimdiden teşekkür ederim.

cevap

2

Ben Bu Ne istediğini ne düşündüğünü çizer istemeden radius, zenith ve azimuth :)

karışık düşünüyorum:

import matplotlib.pyplot as plt 
from mpl_toolkits.mplot3d import Axes3D 
import numpy as np 

fig = plt.figure() 
ax = Axes3D(fig) 

rad = np.linspace(0, 5, 100) 
azm = np.linspace(0, 2 * np.pi, 100) 
r, th = np.meshgrid(rad, azm) 
z = (r ** 2.0)/4.0 

plt.subplot(projection="polar") 

plt.pcolormesh(th, r, z) 
#plt.pcolormesh(th, z, r) 

plt.plot(azm, r, color='k', ls='none') 
plt.grid() 

plt.show() 

enter image description here

Eğer ışın ızgara çizgileri istiyorsanız, yapabilirsiniz Bunları her Theta'yı aşağıdaki gibi ekleyin:

plt.thetagrids([theta * 15 for theta in range(360//15)]) 
Böyle

enter image description here

ve daha radyal ızgaraları: derli toplu ad tutacak numpy ve pyplot ...

:

plt.rgrids([.3 * _ for _ in range(1, 17)]) 

enter image description here

PS