gnuplot: 3D plot of a matrix of data

前端 未结 2 969
[愿得一人]
[愿得一人] 2020-12-06 18:18

How can I plot (a 3D plot) a matrix in Gnuplot having such data structure, using the first row and column as a x and y ticks (the first number of the first row is the number

相关标签:
2条回答
  • 2020-12-06 19:01

    Exactly this data format can be read in with matrix nonuniform:

    set view 50,20
    set ticslevel 0
    splot 'data.txt' matrix nonuniform with lines t ''
    

    This generates the correct tics, like specified in the data file:

    enter image description here

    0 讨论(0)
  • 2020-12-06 19:14

    To plot a 4D plot, using colour as the 4th dimension, you can use

    splot  '1.txt' using 2:3:4:5  every ::1  palette
    #  |                              |
    #  |                              |
    # used for 3d plots            skip the header line
    

    Or do you want to draw a different picture, with x and y being the first column and line, and the numbers in the matrix just represinting z? Then use the following:

    splot '1.txt' every ::1:1 matrix
    

    To add some effects, you can change it to

    set dgrid3d 4,4
    splot '1.txt' every ::1:1 matrix with lines
    
    0 讨论(0)
提交回复
热议问题