Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

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.

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,


(Edit) Thank you both, Frédéric and Emmanuel! Unfortunately, I cannot apply your answers to my problem properly, mainly because I dont fully understand them.

  • In Frédéric's answer, M seem's to be a 2x2x3 array and I'm unable to transfer the approach to my Nx3 matrix.
  • Emmanuel's list(zip(X,Y,Z)) looks very much like list(myMatrix), but no answer: with list_plot3d I would appreciate a negative statement still don't get anything like the anticipated result.

I'll try to provide my example here:

myMatrix=[(0.5, 0.0, 29.0),
 (1.5, 0.0, 29.0),
 (2.5, 0.0, 30.0),
 (3.5, 0.0, 38.0),
 (5.0, 0.0, 45.0),
 (5.01, 0.0, 0.0),
 (6.0, 0.0, 0.0),
 (0.0, 0.8, 26.0),
 (0.5, 0.8, 25.0),
 (1.5, 0.8, 24.0),
 (2.5, 0.8, 25.0),
 (3.5, 0.8, 35.0),
 (5.0, 0.8, 39.0),
 (5.01, 0.8, 0.0),
 (6.0, 0.8, 0.0),
 (0.0, 1.8, 27.0),
 (0.5, 1.8, 25.0),
 (1.5, 1.8, 22.0),
 (2.5, 1.8, 22.0),
 (3.5, 1.8, 27.0),
 (5.0, 1.8, 38.0),
 (5.01, 1.8, 0.0),
 (6.0, 1.8, 0.0),
 (0.0, 2.8, 22.0),
 (0.5, 2.8, 20.0),
 (1.5, 2.8, 19.0),
 (2.5, 2.8, 22.0),
 (3.5, 2.8, 28.0),
 (5.0, 2.8, 42.0),
 (5.01, 2.8, 0.0),
 (6.0, 2.8, 0.0),
 (0.0, 3.8, 14.0),
 (0.5, 3.8, 12.0),
 (1.5, 3.8, 10.0),
 (2.5, 3.8, 13.0),
 (3.5, 3.8, 21.0),
 (5.0, 3.8, 39.0),
 (5.01, 3.8, 0.0)]
myLiPlo3d=list_plot3d(myMatrix,aspect_ratio=[1,1,0.02])
myLiPlo3dLi=list_plot3d(list(myMatrix),aspect_ratio=[1,1,0.02])
myPlo3d=point3d(myMatrix,size=20,aspect_ratio=[1,1,0.02])

Now

show(myPlo3d)

does result in the plot I'm looking for, except for the fact that it's just points and not a connected surface. However, both,

show(myLiPlo3dLi)
show(myLiPlo3d)

result in a totally different scale and shape.


Thinking as "such a function is I'm editing: May this strange scaling be an artifact of perfect polynomial fitting? That's not implemented" as well. Thanks.what I'm looking for, I don't want any overswings (is that an English word?); I'd even be ok with bilinear interpolation.

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) Thank you both, Frédéric and Emmanuel! Unfortunately, I cannot apply your answers to my problem properly, mainly because I dont fully understand them.

  • In Frédéric's answer, M seem's to be a 2x2x3 array and I'm unable to transfer the approach to my Nx3 matrix.
  • Emmanuel's list(zip(X,Y,Z)) looks very much like list(myMatrix), but with list_plot3d I still don't get anything like the anticipated result.

I'll try to provide my example here:

myMatrix=[(0.5, 0.0, 29.0),
 (1.5, 0.0, 29.0),
 (2.5, 0.0, 30.0),
 (3.5, 0.0, 38.0),
 (5.0, 0.0, 45.0),
 (5.01, 0.0, 0.0),
 (6.0, 0.0, 0.0),
 (0.0, 0.8, 26.0),
 (0.5, 0.8, 25.0),
 (1.5, 0.8, 24.0),
 (2.5, 0.8, 25.0),
 (3.5, 0.8, 35.0),
 (5.0, 0.8, 39.0),
 (5.01, 0.8, 0.0),
 (6.0, 0.8, 0.0),
 (0.0, 1.8, 27.0),
 (0.5, 1.8, 25.0),
 (1.5, 1.8, 22.0),
 (2.5, 1.8, 22.0),
 (3.5, 1.8, 27.0),
 (5.0, 1.8, 38.0),
 (5.01, 1.8, 0.0),
 (6.0, 1.8, 0.0),
 (0.0, 2.8, 22.0),
 (0.5, 2.8, 20.0),
 (1.5, 2.8, 19.0),
 (2.5, 2.8, 22.0),
 (3.5, 2.8, 28.0),
 (5.0, 2.8, 42.0),
 (5.01, 2.8, 0.0),
 (6.0, 2.8, 0.0),
 (0.0, 3.8, 14.0),
 (0.5, 3.8, 12.0),
 (1.5, 3.8, 10.0),
 (2.5, 3.8, 13.0),
 (3.5, 3.8, 21.0),
 (5.0, 3.8, 39.0),
 (5.01, 3.8, 0.0)]
myLiPlo3d=list_plot3d(myMatrix,aspect_ratio=[1,1,0.02])
myLiPlo3dLi=list_plot3d(list(myMatrix),aspect_ratio=[1,1,0.02])
myPlo3d=point3d(myMatrix,size=20,aspect_ratio=[1,1,0.02])

Now

show(myPlo3d)

does result in the plot I'm looking for, except for the fact that it's just points and not a connected surface. However, both,

show(myLiPlo3dLi)
show(myLiPlo3d)

result in a totally different scale z-scale and shape.


Thinking as I'm editing: May this strange scaling be an artifact of perfect polynomial fitting? That's not what I'm looking for, I don't want any overswings (is that an English word?); I'd even be ok with bilinear interpolation.