# Plot 3d data

I've been unable to find any viable solution although I'm quite sure there's an easy one.

I'd like to plot a surface from a matrix with some hundred rows that specify a point each, i.e. x y z. The point3d function does the ranges right but lacks the surface option; list_plot3d provides the surface, but does plot by the row/colum indeces instead of the x,y values.

Which function would do the trick?

Ben

(Edit) As there have been a few views, but no answer: I would appreciate a negative statement as "such a function is not implemented" as well. Thanks.

edit retag close merge delete

give us a toy minimal example of the data you want to plot

Sort by » oldest newest most voted

WorksForMe(TM) in Sagecell and in Sage 9.6.rc3. Let's assess the density of a bivariate standard normal by plotting 1000 random points (I use R's functions by pure laziness...) :

set_random_seed(0)
X=r.rnorm(1000,0,1)._sage_()
Y=r.rnorm(1000,0,1)._sage_()
Z=r.dnorm(list(map(lambda u,v:sqrt(u^2+v^2), X, Y)),0,1)._sage_()
P=list_plot3d(list(zip(X,Y,Z)))
show(P, aspect_ratio=[1,1,5])


See for yourself !

HTH,

more Shooting in the dark, here is a tentative

def plot_cloud_matrix(M):
m = len(M)
n = len(M)
P = point3d(M)
for i in range(m-1):
for j in range(n-1):
pta = M[i][j]
ptb = M[i+1][j]
ptc = M[i+1][j+1]
ptd = M[i][j+1]
P += polygon3d([pta,ptb,ptc,ptd])
return P

plot_cloud_matrix([[(0,1,2),(0,1,1.2)],[(0.5,1,2),(0.1,1,1.1)]])

more