Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Splot points over pm3d surface in gnuplot

Tags:

plot

gnuplot

3d

I have plotted a sphere using gnuplot in parametric mode. I am trying to plot 3d data from a file, which will surround the sphere. It seems that the points with overlap with the sphere are hidden even though they should be in front of the shape.

Here's my script:

unset border
unset colorbox
unset key
unset tics

set view equal
set isosamples 64

set pm3d depthorder interpolate 0,0
set palette rgb 3,3,3

set parametric
r = 19

splot 'saturn.txt' linecolor rgb 'black', \
r*sin(u)*cos(v) + 40, r*sin(u)*sin(v) + 40, r * cos(u) + 40.5 w pm3d

Here is the data file, saturn.txt on pastebin

The image below shows my problem. On the left is the full set of data plotted without the sphere. In the middle it can be seen that there are points missing from in front of the sphere. The view on the right shows that these points are definitely in front of the sphere. Is there any way I can plot both at the same time without the points in front of the sphere being hidden?

image showing the problem

like image 285
Tom Fenech Avatar asked Sep 20 '26 22:09

Tom Fenech


1 Answers

I found the answer, in this gnuplotting article:

set hidden3d front

Why exactly that works is a mystery to me. I couldn't find anything relevant in the gnuplot manual about it.

Here's the final plot:enter image description here

like image 160
Tom Fenech Avatar answered Sep 23 '26 22:09

Tom Fenech