Peter S
Peter S

Reputation: 575

Draw Grid on layer 3dPlot (Gnuplot 5)

My Plot looks like this: enter image description here

in order to improve the plot a bit more I would like to view the grid also on the layers like this (sorry for the bad paint job): enter image description here

I checked the grid chapter in the documentation. Is there a way to maybe set a grid for every z tic and then only make it visible on the colored part where data is shown

thx for the help so far, it doesn't quite work, my data looks like this:

2015-03-22 06:00    0.00    0.58    0.00    0.58    9   8.2 8.2 8.2 64  1.8 1.8 NNW 0.11    3.6 NNW 7.2 7.8 6.8 4.7 1016.8  0.00    0.0 0   0.00    0   0.0 0.00    0.0 0.007   0.000   21.4    28  2.2 19.4    0.05    15  1   65.2    1   1.8823831042606498  659.801927242555

2015-03-22 06:01    0.00    0.58    0.00    0.58    9   8.2 8.2 8.2 64  1.8 0.4 NNW 0.03    1.8 NNW 8.2 7.8 7.8 5.6 1016.9  0.00    0.0 0   0.00    0   0.0 0.00    0.0 0.007   0.000   21.4    28  2.2 19.4    0.00    16  1   69.6    1   1.926984097278376   644.530487695342

2015-03-22 06:02    0.00    0.58    0.00    0.58    9   8.2 8.2 8.2 64  1.8 2.7 NNW 0.16    3.1 NNW 6.5 7.8 6.1 3.9 1016.9  0.00    0.0 0   0.00    0   0.0 0.00    0.0 0.007   0.000   21.4    28  2.2 19.4    0.00    11  1   47.8    1   1.8741943892130313  662.6847285150141

there are muliple files, all containing one day in this plot, i use 3:43:1 so one data:data:Date(%Y%m%d)

Upvotes: 0

Views: 81

Answers (1)

tvcuyck
tvcuyck

Reputation: 125

Edit: I noticed this will not work for each type of data set just after I posted. It will depend on the structure of your data, but I left it here because maybe it helps you further. I suggest you give some sample data, which makes it easier to provide a solution.

I think the easiest way is to repeat the plot which produces the colored surfaces with an identical plotting statement, but with lines instead of pm3d. (Presuming you used pm3d). You can change the density of the grid on the surfaces by changing the isosamples.

set isosamples 20,20

sp "data.txt" w pm3d notitle,\
   "data.txt" w l lt 1 lc rgb "grey50" notitle

A full working example

set terminal postscript enhanced color
set output "plot.eps"

# Change these two values to rotate
set view 50,50

# Density of grid for functions
# Higher numbers here will change density if the grid in the surface
set isosamples 20,20 

# Axis labels
set xlabel "x"
set ylabel "y"
set zlabel "z"

# Axis ranges
set xrange[0:5]
set yrange[0:5]
set zrange[0:5]
set cbrange[0:5]

# Defining functions as I have no data
f(x,y)= (x > 0 && x < 2 && y > 1 && y < 3 ) ? 3 : 1/0
g(x,y)= (x > 3 && x < 4 && y > 1 && y < 3 ) ? 4 : 1/0
h(x,y)= (x > 2 && x < 5 && y > 0 && y < 2 ) ? 1 : 1/0
i(x,y)= (x > 4 && x < 5 && y > 3 && y < 5 ) ? 2 : 1/0

# Grid on xy plane
# Change xtics for denser grid
set xtics 1.0
set ytics 1.0

set grid ytics lc rgb "#bbbbbb" lw 1 lt 0
set grid xtics lc rgb "#bbbbbb" lw 1 lt 0

# No colorbox
unset colorbox

# Plotting
sp f(x,y) w pm3d notitle,\
   f(x,y) w l lt 1 lc rgb "grey50" notitle,\
   g(x,y) w pm3d notitle,\
   g(x,y) w l lt 1 lc rgb "grey50" notitle,\
   h(x,y) w pm3d notitle,\
   h(x,y) w l lt 1 lc rgb "grey50" notitle,\
   i(x,y) w pm3d notitle,\
   i(x,y) w l lt 1 lc rgb "grey50" notitle

Produces the following result

result

Upvotes: 1

Related Questions