0
votes

I have a file with four columns. I have plotted 4D-plot using gnuplot tool as follows.

splot 'test.dat' u 1:2:3:($4<200.0?$4/4.184:1/0) w pm3d

Now I want to see a piece of the plot whose X-axis is some constant value. Let's say when the first column is 0.3, I want to see a 3D plot constructed out of 2,3,4 columns.

1
Is your question answered? Any kind of response would be appreciated!theozh

1 Answers

2
votes

You don't show your data, so I assumed something. Similar as you determine your color with the ternary operator you can "filter" a slice with constant x+dx.

Code:

### slice from 4D data
reset session

# create some test data
f(x,y) = x**2 + y**2
c(x,y) = x + y
set print $Data
    do for [i=-10:10] {
        do for [j=-10:10] {
            print sprintf("%.3f %.3f %.3f %.3f", i, j, f(i,j), c(i,j))
        }
        print ""
    }
set print

set xrange [-10:10]
set yrange [-10:10]
set zrange [0:200]
set cbrange [-20:20]

SliceX = 5
dx = 1
set multiplot layout 1,2

    splot $Data u 1:2:3:4 w pm3d notitle 
    splot $Data u ($1>=SliceX && $1<=SliceX+dx?$1:NaN):2:3:4 w pm3d notitle 

unset multiplot
### end of code

Result:

enter image description here