1
votes

I have the below data file which has: 1st column is the layer number. 2nd column is the X axis. 3rd column is the Y axis.

1   1999-01-19  21  0   1
1   2009-07-01  0   1   1
1   2008-08-20  2   1   1
1   2008-12-18  1   1   1
2   2004-05-12  4   1   1
2   2009-07-29  2   1   1
3   2008-08-07  0   1   1
4   2006-03-08  1   1   1
4   2004-08-31  9   1   1
4   2001-03-27  12  1   1

My questions: 1. How can I plot the above data file in 3D knowing that each layer must have different Z offset and different color? the below must be plotted with Z=1

1   1999-01-19  21  0   1
1   2009-07-01  0   1   1
1   2008-08-20  2   1   1
1   2008-12-18  1   1   1

and the below with Z=2

2   2004-05-12  4   1   1
2   2009-07-29  2   1   1

and so on.

2.If I want to select the layer number 2, other layers must be shaded with gray and this layer must be colored with red for example, is that possible? so it's like highlighting the selected layer.

thx.

1

1 Answers

1
votes

To plot the points just use

set xdata time
set timefmt '%Y-%m-%d'
set format x '%Y'
splot 'data.dat' using 2:3:1

That uses the layer number as z-value. To get something else, just specify a function for the z-value depending on the layer number:

zpos(z) = 1 + 0.5*z
splot 'data.dat' using 2:3:(zpos($1))

For the coloring use linecolor rgb variable. That allows you to specify the color in the last column. This color must be the integer representation of an rgb-tuple which is 65536*red + 256*green + blue, with red, green and blue being in the range [0:255].

The following script plots the points in layer 2 in dark red:

set xdata time
set timefmt '%Y-%m-%d'
set format x '%Y'

rgb(r,g,b) = 65536*r + 256*g + b
gray = rgb(200,200,200)
red = rgb(200,0,0)
layer = 2
set view 66,20
splot 'data.dat' using 2:3:1:($1 == layer ? red : gray) with points pt 7 linecolor rgb variable notitle

The result with 4.6.4 is:

enter image description here