user1504209
user1504209

Reputation: 53

Colouring a pm3d surface using a column values

I am trying to colour a splot surface using pm3d and wanted to colour using values from another column instead of the z-axis.

The input file (test.file, tab separated) is :

atom_num    residue_name    X   Y   Z
288 1   45.3    36.6    79.3
301 1   38.9    197.4   72.5
314 1   118.2   53.8    76.5
327 1   58.2    139.1   78.5
353 1   1.9 14.4    71.9
366 1   156.9   180.0   72.1
379 1   183.2   5.4 69.5
392 1   71.7    155.4   75.8
457 1   83.4    11.8    74.8
613 1   97.1    180.7   77.5
626 1   145.2   160.3   71.7
678 2   73.1    76.3    81.0
704 3   30.3    46.5    79.3
717 2   216.0   130.7   85.5
743 2   55.0    137.2   74.4
756 2   23.4    67.3    78.3
769 2   46.9    156.1   77.3
821 2   145.4   143.9   80.7
990 2   7.8 119.3   79.8
1016    3   44.3    67.3    76.7
1042    3   12.8    44.4    74.3
1055    3   149.1   79.9    78.2
1068    3   100.8   35.8    76.1
1081    3   57.6    196.8   76.8
1094    3   214.7   122.8   79.5
1107    3   82.0    190.0   74.4
1120    3   150.9   39.4    71.3
1133    3   50.4    143.7   75.3
1146    1   42.9    104.7   74.3
1159    1   139.0   48.8    73.4
1172    1   66.8    165.3   71.5
1198    1   190.7   150.1   84.2
1211    1   92.1    5.1 75.8
1224    1   211.8   177.7   74.1
1237    1   131.6   0.2 73.6
1250    2   103.8   104.2   76.6
1276    2   132.4   5.0 70.0
1289    2   94.4    9.4 73.0
1302    2   72.6    33.7    74.3
1315    2   14.4    162.6   74.7
1406    2   171.4   143.6   86.1
1419    2   209.5   52.9    77.4
1445    2   11.6    14.7    72.3
1458    1   115.5   165.0   73.0
1549    1   147.1   45.5    76.1
1575    1   115.8   36.6    74.5
1588    1   35.8    37.3    76.2
1601    1   65.4    28.2    76.9
1614    1   13.4    199.9   76.5

The commands I am using is:

set dgrid3d 30,30
set hidden3d
set palette rgbformulae 33,13,10
splot "test.file" u 3:4:5 w pm3d

The image is appearing like this:

enter image description here

The plot is by default colouring based on the Z-axis value (column 5). I am stuck colouring the plot using the values of Residue Name (column 2), which ranges from 1-3. Is there an option to define which coloumn to choose for colouring? Ideally I would like to have the same plot but coloured according to the column 2, so that I can see which "Residue types" lie in which contours.

Any help would hugely helpful.

Upvotes: 1

Views: 1075

Answers (1)

Joce
Joce

Reputation: 2332

As your residue is an integer, it is unclear whether you want it interpolated onto the grid.

However, if that's what you want, you can use the solution in Plotting 3D surface from scatter points and a png on the same 3D graph but don't use with pm3d when writing tables. Here's a solution with a quick and somewhat dirty unix trick to merge the tables:

set terminal push #Save current terminal settings
set terminal unknown #dummy terminal
set table "surface.dat"
set dgrid3d
splot 'test.dat' using 3:4:5
set table "residue.dat"
splot 'test.dat' using 3:4:2
unset dgrid3d
unset table
set term pop #reset current terminal settings
!paste surface.dat residue.dat > test_grid.dat
splot "test_grid.dat" u 1:2:3:7 w pm3d

Upvotes: 2

Related Questions