Search code examples
python3dplotlysurfacegraphing

Python Plotly: X,Y Grid Contour Projection onto 3D Surface


I have a surface that I have created in Plotly where the z data is a matrix (x and y defined by the grid):

     0      1      2      3      4      5      6      7      8      9      10  \
0   0.0  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000   
1   0.0  0.000  0.000  0.000  0.000  0.000  0.000  0.690  0.889  0.690  0.000   
2   0.0  0.000  0.000  0.000  0.000  0.657  0.983  1.068  1.026  1.068  0.983   
3   0.0  0.000  0.000  0.000  0.691  0.937  1.008  1.094  1.112  1.094  1.008   
4   0.0  0.000  0.000  0.691  0.844  0.986  1.085  1.120  1.126  1.120  1.085   
5   0.0  0.000  0.657  0.937  0.986  1.077  1.121  1.130  1.078  1.130  1.121   
6   0.0  0.000  0.983  1.008  1.085  1.121  1.142  1.132  1.117  1.132  1.142   
7   0.0  0.690  1.068  1.094  1.120  1.130  1.132  1.111  1.053  1.111  1.132   
8   0.0  0.889  1.026  1.112  1.126  1.078  1.117  1.053  1.075  1.053  1.117   
9   0.0  0.690  1.068  1.094  1.120  1.130  1.132  1.111  1.053  1.111  1.132   
10  0.0  0.000  0.983  1.008  1.085  1.121  1.142  1.132  1.117  1.132  1.142   
11  0.0  0.000  0.657  0.937  0.986  1.077  1.121  1.130  1.078  1.130  1.121   
12  0.0  0.000  0.000  0.691  0.844  0.986  1.085  1.120  1.126  1.120  1.085   
13  0.0  0.000  0.000  0.000  0.691  0.937  1.008  1.094  1.112  1.094  1.008   
14  0.0  0.000  0.000  0.000  0.000  0.657  0.983  1.068  1.026  1.068  0.983   
15  0.0  0.000  0.000  0.000  0.000  0.000  0.000  0.690  0.889  0.690  0.000   
16  0.0  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000   

       11     12     13     14     15   16  
0   0.000  0.000  0.000  0.000  0.000  0.0  
1   0.000  0.000  0.000  0.000  0.000  0.0  
2   0.657  0.000  0.000  0.000  0.000  0.0  
3   0.937  0.691  0.000  0.000  0.000  0.0  
4   0.986  0.844  0.691  0.000  0.000  0.0  
5   1.077  0.986  0.937  0.657  0.000  0.0  
6   1.121  1.085  1.008  0.983  0.000  0.0  
7   1.130  1.120  1.094  1.068  0.690  0.0  
8   1.078  1.126  1.112  1.026  0.889  0.0  
9   1.130  1.120  1.094  1.068  0.690  0.0  
10  1.121  1.085  1.008  0.983  0.000  0.0  
11  1.077  0.986  0.937  0.657  0.000  0.0  
12  0.986  0.844  0.691  0.000  0.000  0.0  
13  0.937  0.691  0.000  0.000  0.000  0.0  
14  0.657  0.000  0.000  0.000  0.000  0.0  
15  0.000  0.000  0.000  0.000  0.000  0.0  
16  0.000  0.000  0.000  0.000  0.000  0.0

I would like to project the x, y grid with variable size (i.e. the resolution of the grid) onto this 3D surface. I suspect I can use the contour attribute of the 3D Surface object to project onto this surface, but I couldn't find any existing examples.

Please help me and thanks in advance!


Solution

  • Used colorscale parameter of surface object