Is there a way to get GLSurfacePlotItem to plot a surface on a polar grid, rather than filling out the corners of an x, y grid. For example, I'm able to get a simple parabolic shape with matplotlib (see matplotlib attachment) with the following code.
### With matplotlib
from mpl_toolkits import mplot3d
import numpy as np
import matplotlib.pyplot as plt
from coordinates import *
r = np.linspace(0, 10, 100)
theta = np.linspace(0, 2*np.pi, 100)
rr, tt = np.meshgrid(r, theta)
xx, yy = pol_to_cart(rr, tt) # simple conversion function between coordinate systems
zz = xx**2 + yy**2
fig = plt.figure()
ax = plt.axes(projection='3d')
ax.plot_surface(xx, yy, zz, cmap='viridis', edgecolor='none')
plt.show()
###
The best I can get with pyqtgraph is shown in the other attachment, and is achieved with the following code.
### With pyqtgraph
x = np.linspace(-7, 7, 100)
y = np.linspace(-7, 7, 100)
xx, yy = np.meshgrid(x, y)
zz = xx**2 + yy**2
self.surf = gl.GLSurfacePlotItem(x = x, y = y, z = zz, shader = 'shaded')
All of my attempts to do something similar to what I did with matplotlib end in weirdness. Maybe because of how matplot lib takes mesh inputs for x, y, and z, instead of just z? I thought it might be something like the following
### Failed attempt
r = np.linspace(0, 10, 100)
theta = np.linspace(0, 2*np.pi, 100)
rr, tt = np.meshgrid(r, theta)
x, y = pol_to_cart(rr, tt) # simple conversion function between coordinate systems
xx, yy = pol_to_cart(rr, tt) # simple conversion function between coordinate systems
zz = xx**2 + yy**2
self.surf = gl.GLSurfacePlotItem(x = x, y = y, z = zz, shader = 'shaded')
###
But that produces nonsense. Thanks.