3

Is there a way I can hide these overlayed lines in the back of my plot? I tried to use the hidden3d option, but it doesn't work as I expected.

set encoding utf8
set key right top

set xrange[0:1]
set yrange[0:1]

set grid
set ztics 0.01
set palette rgbformulae -5,-12,-30

set xlabel "x" font "Helvetica, 20"
set ylabel "y" font "Helvetica, 20"
set zlabel "z" font "Helvetica, 20"

set terminal postscript eps enhanced color font "Helvetica, 20"
set output "approx_jacobi.eps"

ue(x,y) = sin(pi*x)*sin(pi*y)/(2*pi**2);

#set hidden3d front
set dgrid3d 31, 31 qnorm 2
splot 'results.dat' with pm3d notitle,\
      ue(x,y) w l lw 2 t 'Exact'

The result I'm currently getting is

here it is

Christoph
  • 47,569
  • 8
  • 87
  • 187
ACR
  • 81
  • 1
  • 7
  • Pm3d and hidden3d don't work together very well, though it can happen, that certain configurations do work. Can you upload your data file somewhere? – Christoph Dec 12 '14 at 08:03
  • As far as I remember, gnuplot is not really aware of the position of the objects in 3D. Each plot is just drawn in front of the previous. – sweber Dec 13 '14 at 22:18
  • @sweber For normal surfaces, hidden3d works fine, see e.g. `set hidden3d; splot -5, -0.1*(x**2+y**2)`. It's only `pm3d` which makes problems with hidden surface removal. – Christoph Dec 15 '14 at 08:03
  • @Christoph: Indeed, for two objects plottet as meshes, `hidden3d` works. But in general, even just `pm3d` (without `hidden3d`) has problems to plot intersecting objects correctly. See [this plot testing several options](http://www.atlas.uni-wuppertal.de/~sweber/3d.pdf). Left column shows functions, right data & function. `hidden3d` is used in the last 2 rows only. Due to this, I do not see any solution for @Habsy's problem. – sweber Dec 15 '14 at 09:32
  • Some configurations work fine with `set pm3d depthorder` ([Gnuplot, pm3d and surfaces](http://stackoverflow.com/a/18249166/2604213)). It can also happen, that pm3d works with hidden3d, see [Splot points over pm3d surface in gnuplot](http://stackoverflow.com/q/22204932/2604213). That's why I asked for the data set. But without having it also don't see a solution. – Christoph Dec 15 '14 at 09:47
  • I'm so sorry for the late response. [Here it is](http://www.megafileupload.com/en/file/588279/results-dat.html) my 'results.dat' file. – ACR Dec 15 '14 at 16:47
  • Thanks, see my answer. BTW: If you want to notify someone, you can do this by prefixing his name with an @, like @Christoph. I only came across your update only accidentally. This is not required, if you address the asker or the author of an answer. – Christoph Dec 17 '14 at 21:52

1 Answers1

4

Using set hidden3d front works fine for me. I had to increase the isosamples a bit to avoid intersections of the lines with the surface due to the linear interpolation. Also you don't need to use set dgrid3d since you already have a regular grid.

set pm3d
set hidden3d front
set ticslevel 0
set isosamples 40
set palette rgbformulae -5,-12,-30

ue(x,y) = sin(pi*x)*sin(pi*y)/(2*pi**2)
splot 'results.dat' with pm3d, ue(x,y) w l

The result with 4.6.5 is:

enter image description here

Christoph
  • 47,569
  • 8
  • 87
  • 187