Hi,

I'm trying to plot an outline of an arbitrary 3D shape using 
matplotlib's plot_surface, and I wanted to ask if any one has any ideas 
as to how to do it. Here's the beginnings of a simple example:

# create a grid
resolution = 10

xs = np.linspace(-1,1,resolution)
ys = np.linspace(-1,1,resolution)
zs = np.linspace(-1,1,resolution)

X,Y,Z = np.meshgrid(xs, ys, zs)

#Then we can calculate the square of the distance of each point to the 
center:
W = X**2 + Y**2 + Z**2

# Let's see which points are within a certain radius:
C = W < 1.

# this can be used to create a point-cloud
x = X[C]
y = Y[C]
z = Z[C]

 From this I tried a lot options, the best being to do some XOR 
operations on the array C to get a list of points which are on the 
surface of the sphere. My question is, can anybody see a reasonable way 
to plot this surface using mplot3D?

Of course plotting a sphere can be done using spherical coordinates, but 
that defeats the purpose of this example :) This is just a 
simplification as the application is actually to draw 3D contours (i.e. 
shapes, rather than iso-lines) of a three-parameter probability 
distribution.

Thanks in advance,

-Peter










------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to