Was able to draw polar chart (code below) by using matplotlib.pyplot
and trying to draw 3D chart from this data by using Axes3D, but not getting a clue how to plot.
Using python 2.7.
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
ax1 = fig.add_subplot(121, polar=True)
ax2 = fig.add_subplot(122, polar=True)
h = [-20, -15, -10, -5, 0, -3, -10, -16, -20 ] # horizontal data
v = [ 0, -5, -15, -18, -20, -10, -5, -1, 0 ] # vertical data
theta = np.linspace( 0, -2 * np.pi, 9 ) # theta
x_range_1 = [ 90, 45, 0, -45, -90, -135, 180, 135 ]
x_range_2 = [ 0, -45, -90, -135, 180, 135, 90, 45 ]
ax1.set_rmax(0)
ax1.set_rmin(-40)
ax1.set_yticks(range(-40, 0, 5))
ax1.set_xlim(135)
ax1.set_xticklabels(x_range_1)
ax2.set_rmax(0)
ax2.set_yticks(range(-40, 0, 5))
ax2.set_xlim(135)
ax2.set_xticklabels(x_range_2)
ax1.grid( True )
ax1.plot( theta, h, label = 'horizontal' )
ax2.grid( True )
ax2.plot( theta, v, label = 'vertical' )
plt.show()
Below is the 3D code i tried.. ax1 displays horizontal polar chart and ax2 is 3D (but, i am sure that 3D is not something right..)
from mpl_toolkits.mplot3d import axes3d
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
ax1 = fig.add_subplot(121, polar=True)
ax2 = fig.add_subplot(122, projection='3d')
h = [ -20, -15, -10, -5, 0, -3, -10, -16, -20 ] # horizontal data
v = [ 0, -5, -15, -18, -20, -10, -5, -1, 0 ] # vertical data
theta = np.linspace( 0, -2 * np.pi, 9 ) # theta
x_range_1 = [ 90, 45, 0, -45, -90, -135, 180, 135 ]
x_range_2 = [ 0, -45, -90, -135, 180, 135, 90, 45 ]
ax1.set_rmax(0)
ax1.set_rmin(-40)
ax1.set_yticks(range(-40, 0, 5))
ax1.set_xlim(135)
ax1.set_xticklabels(x_range_1)
ax1.grid( True )
ax1.plot( theta, h, label = 'horizontal' )
ax2.grid( True )
R,P = np.meshgrid( h, theta )
X,Y = R * np.cos(P), R * np.sin(P) # transform [R,P] to cartesian system
Z = v # ( ( R**2 - 1 )**2 )
ax2.plot_surface( X, Y, Z, label = '3d' )
plt.show()
Below is the output of above program
https://docs.google.com/file/d/0Bw8wTgcsK-k8d3JvRmVuUUxfSE0/edit
Below is the kind of diagram i am actually expecting,
https://docs.google.com/file/d/0Bw8wTgcsK-k8aFZhcnZPYmJTdkk/edit
Thanks in advance for your help.