3D Plotting from X, Y, Z Data, Excel or other Tools

后端 未结 5 1627
温柔的废话
温柔的废话 2021-02-13 02:18

I have data that looks like this:

1000    13  75.2
1000    21  79.21
1000    29  80.02
5000    29  87.9
5000    37  88.54
5000    45  88.56
10000   29  90.11
100         


        
相关标签:
5条回答
  • 2021-02-13 02:28

    You really can't display 3 columns of data as a 'surface'. Only having one column of 'Z' data will give you a line in 3 dimensional space, not a surface (Or in the case of your data, 3 separate lines). For Excel to be able to work with this data, it needs to be formatted as shown below:

          13    21   29      37    45   
    1000  75.2                              
    1000       79.21                            
    1000             80.02                      
    5000             87.9                   
    5000                    88.54               
    5000                           88.56            
    10000            90.11      
    10000                   90.79   
    10000                          90.87
    

    Then, to get an actual surface, you would need to fill in all the missing cells with the appropriate Z-values. If you don't have those, then you are better off showing this as 3 separate 2D lines, because there isn't enough data for a surface.

    The best 3D representation that Excel will give you of the above data is pretty confusing:

    enter image description here

    Representing this limited dataset as 2D data might be a better choice:

    enter image description here

    As a note for future reference, these types of questions usually do a little better on superuser.com.

    0 讨论(0)
  • 2021-02-13 02:29

    You also can use Gnuplot which is also available from gretl. Put your x y z data on a text file an insert the following

    splot 'test.txt' using 1:2:3 with points palette pointsize 3 pointtype 7
    

    Then you can set labels, etc. using

    set xlabel "xxx" rotate parallel
    set ylabel "yyy" rotate parallel
    set zlabel "zzz" rotate parallel
    set grid
    show grid
    unset key
    
    0 讨论(0)
  • 2021-02-13 02:31

    Why not merge the rows that contain the same values? -

             13    21    29     37    45   
    
    • 1000] -75.2 -- 79.21 -- 80.02

    • 5000] ---------------------87.9---88.54----88.56

    • 10000] -------------------90.11--90.97----90.87

    Excel can use that pretty well..

    0 讨论(0)
  • 2021-02-13 02:33

    I ended up using matplotlib :)

    from mpl_toolkits.mplot3d import Axes3D
    from matplotlib import cm
    import matplotlib.pyplot as plt
    import numpy as np
    x = [1000,1000,1000,1000,1000,5000,5000,5000,5000,5000,10000,10000,10000,10000,10000]
    y = [13,21,29,37,45,13,21,29,37,45,13,21,29,37,45]
    z = [75.2,79.21,80.02,81.2,81.62,84.79,87.38,87.9,88.54,88.56,88.34,89.66,90.11,90.79,90.87]
    fig = plt.figure()
    ax = fig.gca(projection='3d')
    ax.plot_trisurf(x, y, z, cmap=cm.jet, linewidth=0.2)
    plt.show()
    
    0 讨论(0)
  • 2021-02-13 02:51

    You can use r libraries for 3 D plotting.

    Steps are:

    First create a data frame using data.frame() command.

    Create a 3D plot by using scatterplot3D library.

    Or You can also rotate your chart using rgl library by plot3d() command.

    Alternately you can use plot3d() command from rcmdr library.

    In MATLAB, you can use surf(), mesh() or surfl() command as per your requirement.

    [http://in.mathworks.com/help/matlab/examples/creating-3-d-plots.html]

    0 讨论(0)
提交回复
热议问题